scope_injector 0.0.1 copy "scope_injector: ^0.0.1" to clipboard
scope_injector: ^0.0.1 copied to clipboard

retractedoutdated

A Dependency Injection library, that provides a simple way to manage your dependencies.

Features #

  • ✅ Dependency injection with singletons and factories
  • ✅ Scope system
  • ✅ Dependency injection with qualifiers
  • ✅ Module System

Getting started #

Installation #

Usage #

First is necessary to create a class that extends from Module and override the onProvide method. Inside this method you can use the provide method to register your dependencies.

class NetworkingDiModule extends Module {
  NetworkingDiModule(super.scopedState);

  @override
  void onProvide() {
    provide(() {
      final dio = Dio(
        BaseOptions(
            baseUrl: baseUrl,
            connectTimeout: const Duration(seconds: 5),
            receiveTimeout: const Duration(seconds: 5)),
      );
      dio.interceptors.add(JwtInterceptor(inject()));
      return dio;
    });

    // Services
    provide(() => UserService(inject()));
    provide(() => ProjectService(inject()));
    provide(() => ExpenseService(inject()));
    provide(() => PaymentService(inject()));
    provide(() => LogService(inject()));
  }
}

Additional information #

2
likes
0
points
150
downloads

Publisher

unverified uploader

Weekly Downloads

A Dependency Injection library, that provides a simple way to manage your dependencies.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on scope_injector