https://github.com/mohanedzekry/flutter-injectable-example
This is an example of how to implement Dependency Injection in your own Flutter project.
https://github.com/mohanedzekry/flutter-injectable-example
bloc clean-architecture dart dependancy-injection equatable flutter injectable routing servicelocator
Last synced: about 1 month ago
JSON representation
This is an example of how to implement Dependency Injection in your own Flutter project.
- Host: GitHub
- URL: https://github.com/mohanedzekry/flutter-injectable-example
- Owner: MohanedZekry
- Created: 2022-12-16T17:12:53.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-12-16T17:31:39.000Z (almost 3 years ago)
- Last Synced: 2025-06-17T12:46:23.704Z (4 months ago)
- Topics: bloc, clean-architecture, dart, dependancy-injection, equatable, flutter, injectable, routing, servicelocator
- Language: Dart
- Homepage:
- Size: 97.7 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Flutter Injectable Example ##
This is an example of how to implement Dependency Injection in your own Flutter project.
## Requirements ##
- [Get-It](https://pub.dev/packages/get_it)
- [Injectable](https://pub.dev/packages/injectable)
- [BLoC](https://pub.dev/packages/flutter_bloc)
- [GoRouter](https://pub.dev/packages/go_router)
- [Equatable](https://pub.dev/packages/equatable)## 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();
........
```