Skip to content

This is an example of how to implement Dependency Injection in your own Flutter project.

Notifications You must be signed in to change notification settings

MohanedZekry/flutter-injectable-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flutter Injectable Example

This is an example of how to implement Dependency Injection in your own Flutter project.

Requirements

How to Add Dependencies

To add a dependency, all you need to do is call this code below:

@InjectableInit
void configureDependencies() => getIt.init();  

To handle the generation file run this command on your terminal

flutter pub run build_runner build --delete-conflicting-outputs

It will generates a new file 'injection.config.dart', which will include all dependencies for all use cases.

and on your main func

void main() {
  configureDependencies(); 
  ........