ricardoemerson / create-flutter-widgets-and-classes

Extension that creates Flutter Stateless or Stateful Widgets, Screens, MobX Store and Classes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The Module generated classes are outdated.

Kemorave opened this issue · comments

The extension generates an old version of the class causing errors to show up.

The generated code:

class HomeModule extends Module {
  @override
  List<Bind> get binds => [
        Bind.lazySingleton((i) => HomeController()),
      ];

  @override
  List<ModularRoute> get routes => [
        ChildRoute('/', child: (context, args) => const HomePage()),
      ];
}

The updated code:

class HomeModule extends Module {
  @override
  void binds(Injector i) {
    i.addLazySingleton<HomeController>(HomeController.new);
  }

  @override
  void routes(RouteManager r) {
    r.add(ChildRoute('/', child: (context) => const HomePage()));
  }
}

related library is flutter_modular and its breaking changes since v6

It seems this is already fixed in v4 of the extension, but it's not released on the market yet, sorry for the inconvenience I will make sure to see the what's new section first before creating issues.
@ricardoemerson