flutter_injections 1.0.2-beta copy "flutter_injections: ^1.0.2-beta" to clipboard
flutter_injections: ^1.0.2-beta copied to clipboard

This package helps you manage any dependencies in your project with whithout context and is possible to create dependencies for modules.

Flutter Injections #

This package helps you to manage any dependencies in your project without need to use context and makes possible to create dependencies for modules. The objective is help any developer to manage dependencies with a easy to use API.

Learn more #

More details on the documentation.

Why Flutter Injections? #

  • Fast and Efficient

    Flutter Injections use search-tree to get the dependencies, this improve the speed to get them, and use less CPU to search for specific objects.

  • Module Injections

    Create module injections that have all dependencies needed on your widgets. I.E HomeInjections have all dependencies needed on HomePage.

  • Easy to use

    The focus is to keep it simple to handle dependencies on large scale applications.

  • Auto dispose

    Objects are auto disposed when FlutterInjection is removed from the Widget Tree.

  • Simple dispose

    With Flutter Injections you can dispose a specific object using __dispose<T> method.

How to use #

It`s simple, just three steps:

  1. Add the FlutterInjections to pubspec.yaml file

    flutter_injections: ^any # or current version
    
  2. Create your FlutterInjections anywhere you to need.

    class YourPageInjections extends StatelessWidget {
      const YourPageInjections({Key? key}) : super(key: key);
    
      @override
      Widget build(BuildContext context) {
        return FlutterInjections(injections: [
          Inject<YourRepository>((i) => YourRepository(client: i.find<Dio>())),
          Inject<YourController>(
              (i) => YourController(repository: i.find<YourRepository>())),
        ], child: const YourPage());
      }
    }
    
  3. And finally, use it to get the dependencies:

    final controller = FlutterInjections.get<YourController>();
    
  • Direct and simple! Good job and have fun!
19
likes
0
pub points
15%
popularity

Publisher

verified publishergabul.dev

This package helps you manage any dependencies in your project with whithout context and is possible to create dependencies for modules.

Homepage

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_injections