Start
The koin_flutter
package is dedicated to provide Koin powers to Flutter world.
startKoin() from your Application
From your Application
class you can use the startKoin
as follow:
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
startKoin((app) {
app.printLogger(level: Level.debug);
app.modules(myAppModules)
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage());
}
}