This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
final List<ModularRoute> routes = [ | |
ChildRoute('/', child: (_, args) => SplashPage()), | |
ModuleRoute('/home', guards: [HomeGuard()], module: HomeModule()),] | |
//Wildcard | |
WildcardRoute(child: (_, args) => UnknownPage()), | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppModule extends MainModule { | |
final List<Bind> binds = []; | |
@override | |
final List<ModularRoute> routes = [ | |
ChildRoute('/', child: (_, args) => SplashPage()), | |
//added HomeModule | |
ModuleRoute('/home', module: HomeModule()), | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HomeModule extends ChildModule { | |
@override | |
final List<ModularRoute> routes = [ | |
ChildRoute('/', child: (_, args) => HomePage()), | |
ChildRoute('/details', child: (_, args) => DetailsPage()), | |
]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
final List<ModularRoute> routes = [ | |
ChildRoute('/', child: (_, args) => SplashPage()), | |
ChildRoute('/home', child: (_, args) => HomePage()), | |
]; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
runApp(ModularApp( | |
module: AppModule(), | |
)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppWidget extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Demo with Modular', | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
), | |
).modular(); //added this | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppModule extends MainModule { | |
@override | |
final List<Bind> binds = []; | |
@override | |
final List<ModularRoute> routes = []; | |
@override | |
final Widget bootstrap = AppWidget(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.6' | |
services: | |
postgres: | |
image: postgres:12 | |
restart: always | |
volumes: | |
- db_data:/var/lib/postgresql/data | |
environment: | |
POSTGRES_PASSWORD: aca7bf1848d05986699f501541412f58 # postgrespassword | |
graphql-engine: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
List<Bind> get binds { | |
//before | |
Bind((i) => HomeController(repository: i.get<MyRepository>(), | |
//now | |
$HomeController, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
part “home_controller.g.dart” | |
@Injectable() | |
class HomeController { | |
final MyRepository repository; | |
HomeController({this.repository}); | |
... | |
} |