A simple dependency injection plugin for Flutter and Dart.

Overview

flutter_simple_dependency_injection

A simple dependency injection plugin for Flutter and Dart.

This implementation does not rely on the dart reflection apis (mirrors) and favours a simple factory based approach. This increases the performance and simplicity of this implementation.

  • Support for multiple injectors (useful for unit testing or code running in isolates)
  • Support for types and named types
  • Support for singletons
  • Support simple values (useful for configuration parameters like api keys or urls)

Any help is appreciated! Comment, suggestions, issues, PR's!

Getting Started

In your flutter or dart project add the dependency:

dependencies:
  ...
  flutter_simple_dependency_injection: any

For help getting started with Flutter, view the online documentation.

Usage example

Import flutter_simple_dependency_injection

import 'package:flutter_simple_dependency_injection/injector.dart';

Injector Configuration

As this injector relies on factories rather than reflection (as mirrors in not available in Flutter) each mapped type needs to provide a factory function. In most cases this can just be a simple new object returned function. In slightly more advanced scenarios where the type to be created relies on other types an injector instances is passed into the factory function to allow the type of be created to get other types it depends on (see below for examples).

((i) => Logger(), isSingleton: true); injector.map((i) => "https://api.com/", key: "apiUrl"); injector.map( (i) => SomeService(i.get(), i.get(key: "apiUrl"))); // note that you can configure mapping in a fluent programming style too injector.map((injector) => SomeType("0")) ..map((injector) => SomeType("1"), key: "One") ..map((injector) => SomeType("2"), key: "Two"); injector.mapWithParams((i, p) => SomeOtherType(p["id"])); return injector; } } class Logger { void log(String message) => print(message); } class SomeService { final Logger _logger; final String _apiUrl; SomeService(this._logger, this._apiUrl); void doSomething() { _logger.log("Doing something with the api at '$_apiUrl'"); } } class SomeType { final String id; SomeType(this.id); } class SomeOtherType { final String id; SomeOtherType(this.id); } ">
import 'package:flutter_simple_dependency_injection/injector.dart';

void main() {
  // it is best to place all injector initialisation work into one or more modules
  // so it can act more like a dependency injector than a service locator.
  // The Injector implements a singleton pattern. You can get a singleton injector instance
  // just by calling Injector().
  final injector = ModuleContainer().initialise(Injector());

  // NOTE: it is best to architect your code so that you never need to
  // interact with the injector itself.  Make this framework act like a dependency injector
  // by having dependencies injected into objects in their constructors.  That way you avoid
  // any tight coupling with the injector itself.

  // Basic usage, however this kind of tight couple and direct interaction with the injector
  // should be limited.  Instead prefer dependencies injection.

  // simple dependency retrieval and method call
  injector.get<SomeService>().doSomething();

  // get an instance of each of the same mapped types
  final instances = injector.getAll<SomeType>();
  print(instances.length); // prints '3'

  // passing in additional arguments when getting an instance
  final instance =
      injector.get<SomeOtherType>(additionalParameters: {"id": "some-id"});
  print(instance.id); // prints 'some-id'
}

class ModuleContainer {
  Injector initialise(Injector injector) {
    injector.map<Logger>((i) => Logger(), isSingleton: true);
    injector.map<String>((i) => "https://api.com/", key: "apiUrl");
    injector.map<SomeService>(
        (i) => SomeService(i.get<Logger>(), i.get<String>(key: "apiUrl")));

    // note that you can configure mapping in a fluent programming style too
    injector.map<SomeType>((injector) => SomeType("0"))
            ..map<SomeType>((injector) => SomeType("1"), key: "One")
            ..map<SomeType>((injector) => SomeType("2"), key: "Two");

    injector.mapWithParams<SomeOtherType>((i, p) => SomeOtherType(p["id"]));

    return injector;
  }
}

class Logger {
  void log(String message) => print(message);
}

class SomeService {
  final Logger _logger;
  final String _apiUrl;

  SomeService(this._logger, this._apiUrl);

  void doSomething() {
    _logger.log("Doing something with the api at '$_apiUrl'");
  }
}

class SomeType {
  final String id;
  SomeType(this.id);
}

class SomeOtherType {
  final String id;
  SomeOtherType(this.id);
}

Remove mappings

You can remove a mapped a factory/instance at any time:

  injector.removeMapping();

  injector.removeMapping(key: 'some_key');

  injector.removeAllMappings();

Multiple Injectors

The Injector class has a factory constructor that by default returns the default singleton instance of the injector. In most cases this will be enough. However, you can pass a name into this factory constructor to return another isolated injector that is independent from the default injector. Passing in a new injector name will create the injector if it has not be retrieved before.

  final defaultInjector = Injector();
  final isolatedInjector = Injector("Isolated");

To destroy an injector instance call its dispose method. The particular instance of the injector with all mappings will be removed.

  Injector().dispose();
  Injector("Isolated").dispose();
Comments
  • NullSafety & Overriding option.

    NullSafety & Overriding option.

    • Create a nammed parameter called overriding by default your value are false (for compatibility with existing behavior);
    • Create test for existing behavior (not allowed override), and the new one (allowed override).
    opened by rcorbellini 8
  • [Feature Request] Allow async in Map FactoryFn

    [Feature Request] Allow async in Map FactoryFn

    Dear author, thanks for my love package. It will better if we can use async in Factory function because some case we use Future to create instance. ex: we can't do this now:

    injector.map<SharedPreferences>((i) async => SharedPreferences.getInstance(), isSingleton: true);
    
    opened by lyquocnam 8
  • Feature Request and Thank You!

    Feature Request and Thank You!

    Hello,

    thank you for your work you have done already!

    Two questions:

    • Are you planning to maintain this package in the future, because we want to implement it into our software.
    • Is it planned to have property injection with annotations like @injectable? This would be great.

    Thanks for your time,

    Niklas

    opened by HerrNiklasRaab 7
  • Optimized code in injector and added a possibility for method chaining

    Optimized code in injector and added a possibility for method chaining

    We use a fork of your great library with some patched code which I now committed in this PR. All tests are green.

    • Optimized code in injector (more concise and faster for some methods).
    • Added a possibility to chain method calls using cascade operator.

    Thanks for accepting this PR in advance. I would be happy if you could release a new version of this lib.

    opened by ova2 5
  • Why has this package a dependency on flutter?

    Why has this package a dependency on flutter?

    Hi @jonsamwell,

    why does this package depend on flutter, can we kill this dependency? Because now we are going to remove the flutter dependency from our business logic package.

    Best wishes,

    Niklas

    opened by HerrNiklasRaab 5
  • getAll with base types possible?

    getAll with base types possible?

    Hello jonsamwell,

    is it possible to implement following behaviour without reflection:

    UserRepository _userRepository = Injector.getInjector().get<UserRepository>();
    ChatRepository _chatRepository = Injector.getInjector().get<ChatRepository>();
    PostRepository _postRepository = Injector.getInjector().get<PostRepository>();
    
    var allRepositories = Injector.getInjector().getAll<BaseRepository>();
    

    Every Repository is derived from BaseRepository.

    Would be a nice feature :).

    Niklas

    opened by HerrNiklasRaab 5
  • Question on registering generic class

    Question on registering generic class

    First of all, thank you for the great package, it helped me a lot. What I am trying to do is to register generic class and didn't find if that's possible with this package. Could you please advise? I have the following class:

    import 'dart:developer';
    
    abstract class Logger<T> {
      void info(String message);
    }
    
    class MyLogger<T> implements Logger<T> {
      @override
      void info(String message) {
        log(message, name: T.toString());
      }
    }
    

    And trying to inject it the following way:

    if (!injector.isMapped<Logger/*=S*/>()) {
        injector.map<Logger/*=S*/>(
            (i) => MyLogger/*=S*/(),
        );
    }
    

    Finally, I am trying to use this setup:

    final logger = Injector().get<Logger<LoadingScreen>>();
    logger.info('Message');
    

    and see the following message in developer console:

    I/flutter ( 9776): reporting fatal error: Injector Exception: Cannot find object factory for 'Logger<LoadingScreen>::default'
    I/flutter ( 9776): #0      Injector.get (package:flutter_simple_dependency_injection/src/injector.dart:237:7)
    I/flutter ( 9776): #1      _LoadingScreenState._initAppData (package:monitask/screens/loading.dart:48:26)
    I/flutter ( 9776): <asynchronous suspension>
    

    If I change my code to this: Injector().get<Logger<dynamic>>() it works but this is not how I wanted to use it, I want to use it like get<Logger<ClassA>>() get<Logger<ClassB>>() etc I am a little bit new to dart and flutter and don't know if that possible at all. Any suggestions would be very appreciated Thank you!

    opened by sxtfv 4
  • Stack Overflow error

    Stack Overflow error

    Hi. Great package, however I'm running into some nasty error which might or might not be caused by your plugin.

    I am using couple of map methods and some of them are not singletons. It looks like this

          _injector.map<ApiClient>(
            (i) => ApiClient(),
            isSingleton: false,
          )
          ..map<AuthorizedApiClient>(
            (i) => AuthorizedApiClient(
              apiClient: i.get<ApiClient>(),
              authenticationRepository: i.get<AuthenticationRepository>(),
              logger: i.get<LoggerService>(),
            ),
            isSingleton: false,
          )
          ..map<AuthenticationApi>(
              (i) => AuthenticationApi(
                      apiClient: i.get<ApiClient>()),
              isSingleton: true)
          ..map<ApiA>(
              (i) => ApiA(
                      apiClient: i.get<AuthorizedApiClient>(
                  )),
              isSingleton: true)
          ..map<ApiB>(
            (i) => ApiB(
                apiClient: i.get<AuthorizedApiClient>()),
            isSingleton: true,
          );
    

    Then when I use it later in the code:

          ..map<UserRepository>(
              (i) => UserRepository(
                    apiB: i.get<ApiB>(), // <-- problematic line
                    errorMonitoringService: i.get<ErrorMonitoringService>(),
                    userStorage: i.get<UserStorage>(),
                  ),
              isSingleton: true)
    
    

    When I add the line apiB: i.get<ApiB>() it throws this error

    flutter: Stack Overflow
    flutter: #0      Injector._makeKeyPrefix (package:flutter_simple_dependency_injection/src/injector.dart:79:3)
    #1      Injector._makeKey (package:flutter_simple_dependency_injection/src/injector.dart:77:10)
    #2      Injector.get (package:flutter_simple_dependency_injection/src/injector.dart:234:23)
    #3      AppContainer._createApiServices.<anonymous closure> (package:subscription_commute_driver_app_flutter/app_container.dart:94:29)
    #4      Injector.map.<anonymous closure> (package:flutter_simple_dependency_injection/src/injector.dart:128:26)
    #5      TypeFactory.get (package:flutter_simple_dependency_injection/src/type_factory.dart:20:32)
    #6      Injector.get (package:flutter_simple_dependency_injection/src/injector.dart:240:26)
    #7      AppContainer._createApiServices.<anonymous closure> (package:subscription_commute_driver_app_flutter/app_container.dart:102:24)
    #8      Injector.map.<anonymous closure> (package:flutter_simple_dependency_injection/src/injector.dart:128:26)
    #9      TypeFactory.get (p<…>
    
    

    It only happens when I pass apiB dependency to UserRepository constructor. I found out if I remove

    ..map<ApiB>(
            (i) => ApiB(
               apiClient: i.get<AuthorizedApiClient>() /* <-- REMOVE DEPENDENCY */),
            isSingleton: true,
          )
    

    and change it to

    ..map<ApiB>(
          (i) => ApiB(),
          isSingleton: true,
        )
    

    The error no longer happens. This is not a "fix" as I obviously need the dependency there but it's a point where it fails.

    I am aware that this error could be thrown for any number of reasons but would you have any idea where to start looking at the problem? It seems to instantiate ApiB instance just fine. I have checked if AuthorizedApiClient is really being created twice just to make sure (because my code expects each apiClient to be separate instance) by printing out hashCode and they are indeed different.

    opened by comatory 3
  • Renamings (suggestion for better names)

    Renamings (suggestion for better names)

    When my PR is accepted (https://github.com/jonsamwell/flutter_simple_dependency_injection/pull/15), I would like to discuss some renamings with you. I would like to suggest the following renamings in public API which fit better the dependency injection in my opinion:

    map<T> -> bind<T> removeMapping<T> -> unbind<T> removeAllMappings<T> -> unbindAll<T> mapWithParams<T> -> bindWithParams<T> additionalParameters -> params key -> qualifier

    One note to the "key". In other DI frameworks (such as Spring DI container, etc.), they speak about "qualifier". You can define and inject different instances of the same type by using qualifiers. An example of unbind method with qualifier:

    Injector unbind<T>({String qualifier}) {
      final objectKey = _makeKey(T, qualifier);
      if (_factories.containsKey(objectKey)) {
        _factories.remove(objectKey);
      }
      return this;
    }
    

    What do you think? If you agree, I will do all work (renamings + changes in README) and provide a PR. Thanks.

    opened by ova2 3
  •  A value of type 'HttpClient' can't be assigned to a variable of type 'IClient'.

    A value of type 'HttpClient' can't be assigned to a variable of type 'IClient'.

    getting this error whenever i build for web using "flutter build web" ➜ pressy_admin git:(master) ✗ flutter build web Running "flutter pub get" in pressy_admin... 0.6s #0 Dart2JSTarget.build (package:flutter_tools/src/build_system/targets/web.dart:154:7) #1 _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:526:25) #2 _BuildInstance.invokeTarget. (package:flutter_tools/src/build_system/build_system.dart:481:35) #3 new Future.sync (dart:async/future.dart:224:31) #4 AsyncMemoizer.runOnce (package:async/src/async_memoizer.dart:43:45) #5 _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:481:21) #6 BuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:419:36) #7 _AsyncAwaitCompleter.start (dart:async-patch/async_patch.dart:43:6) #8 BuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:400:28) #9 buildWeb (package:flutter_tools/src/web/compile.dart:33:48) #10 _asyncThenWrapperHelper. (dart:async-patch/async_patch.dart:71:64) #11 _rootRunUnary (dart:async/zone.dart:1132:38) #12 _CustomZone.runUnary (dart:async/zone.dart:1029:19) #13 _FutureListener.handleValue (dart:async/future_impl.dart:137:18) #14 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45) #15 Future._propagateToListeners (dart:async/future_impl.dart:707:32) #16 Future._completeWithValue (dart:async/future_impl.dart:522:5) #17 _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:30:15) #18 _completeOnAsyncReturn (dart:async-patch/async_patch.dart:288:13) #19 injectPlugins (package:flutter_tools/src/plugins.dart) #20 _asyncThenWrapperHelper. (dart:async-patch/async_patch.dart:71:64) #21 _rootRunUnary (dart:async/zone.dart:1132:38) #22 _CustomZone.runUnary (dart:async/zone.dart:1029:19) #23 _FutureListener.handleValue (dart:async/future_impl.dart:137:18) #24 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45) #25 Future._propagateToListeners (dart:async/future_impl.dart:707:32) #26 Future._completeWithValue (dart:async/future_impl.dart:522:5) #27 Future._asyncComplete. (dart:async/future_impl.dart:552:7) #28 _rootRun (dart:async/zone.dart:1124:13) #29 _CustomZone.run (dart:async/zone.dart:1021:19) #30 _CustomZone.runGuarded (dart:async/zone.dart:923:7) #31 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:963:23) #32 _microtaskLoop (dart:async/schedule_microtask.dart:41:21) #33 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5) #34 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:116:13) #35 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:173:5)

    Exception: lib/main.dart:44:38:
    Error: A value of type 'HttpClient' can't be assigned to a variable of type 'IClient'.

    • 'HttpClient' is from 'package:pressy_admin/utils/network/http_client.dart' ('lib/utils/network/http_client.dart').
    • 'IClient' is from 'lib/utils/network/base_client.dart'. services.addScoped((_) => HttpClient()); ^ lib/main.dart:50:24: Error: The argument type 'IClient/1/' can't be assigned to the parameter type 'IClient/2/'.
    • 'IClient/1/' is from 'lib/utils/network/base_client.dart'.
    • 'IClient/2/' is from 'package:pressy_admin/utils/network/base_client.dart' ('lib/utils/network/base_client.dart'). client: services.getService(), ^ lib/main.dart:55:24: Error: The argument type 'IClient/1/' can't be assigned to the parameter type 'IClient/2/'.
    • 'IClient/1/' is from 'lib/utils/network/base_client.dart'.
    • 'IClient/2/' is from 'package:pressy_admin/utils/network/base_client.dart' ('lib/utils/network/base_client.dart'). client: services.getService(), ^ lib/main.dart:60:24: Error: The argument type 'IClient/1/' can't be assigned to the parameter type 'IClient/2/'.
    • 'IClient/1/' is from 'lib/utils/network/base_client.dart'.
    • 'IClient/2/' is from 'package:pressy_admin/utils/network/base_client.dart' ('lib/utils/network/base_client.dart'). client: services.getService(), ^ lib/main.dart:66:24: Error: The argument type 'IClient/1/' can't be assigned to the parameter type 'IClient/2/'.
    • 'IClient/1/' is from 'lib/utils/network/base_client.dart'.
    • 'IClient/2/' is from 'package:pressy_admin/utils/network/base_client.dart' ('lib/utils/network/base_client.dart'). client: services.getService())); ^ lib/main.dart:71:24: Error: The argument type 'IClient/1/' can't be assigned to the parameter type 'IClient/2/'.
    • 'IClient/1/' is from 'lib/utils/network/base_client.dart'.
    • 'IClient/2/' is from 'package:pressy_admin/utils/network/base_client.dart' ('lib/utils/network/base_client.dart'). client: services.getService())); ^ Error: Compilation failed.

    Failed to compile application for the Web

    flutter doctor summary: [✓] Flutter (Channel master, v1.10.15-pre.121, on Mac OS X 10.15 19A583, locale en-US) • Flutter version 1.10.15-pre.121 at /Users/drlegend/Documents/installation_files/flutter • Framework revision b857632306 (4 hours ago), 2019-10-15 00:07:32 -0700 • Engine revision 540fc977bb • Dart version 2.6.0 (build 2.6.0-dev.7.0 70a7ef3f58)

    [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) • Android SDK at /Users/drlegend/Library/Android/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 29.0.2 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405) • All Android licenses accepted.

    [✓] Xcode - develop for iOS and macOS (Xcode 11.0) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.0, Build version 11A420a • CocoaPods version 1.8.3

    [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

    [✓] Android Studio (version 3.5) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 40.2.2 • Dart plugin version 191.8423 • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

    [✓] VS Code (version 1.39.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.4.1

    [✓] Connected device (2 available) • Chrome • chrome • web-javascript • Google Chrome 77.0.3865.90 • Headless Server • headless-server • web-javascript • Flutter Tools

    • No issues found!

    issues in main.dart file void main() { BlocSupervisor.delegate = SimpleBlocDelegate(); runApp(Application(services: configureServices())); }

    IServiceCollection configureServices() { final services = ServiceCollectionImpl();

    services.addSingleton((_) => AuthSessionImpl());

    services.addSingleton((_) => MemberSessionImpl());

    services.addScoped((_) => HttpClient()); // on this line

    services.addScoped((_) => ApiEndpointProvider());

    services.addScoped((services) => AuthDataSourceImpl( apiEndpointProvider: services.getService(), client: services.getService(), authSession: services.getService()));

    services.addScoped((services) => OrderDataSourceImpl( apiEndpointProvider: services.getService(), client: services.getService(), authSession: services.getService()));

    services.addScoped((services) => ArticleDataSourceImpl( apiEndpointProvider: services.getService(), client: services.getService(), authSession: services.getService()));

    services.addScoped((services) => SlotDataSourceImpl( apiEndpointProvider: services.getService(), authSession: services.getService(), client: services.getService()));

    services.addScoped((services) => MemberDataSourceImpl( apiEndpointProvider: services.getService(), authSession: services.getService(), client: services.getService()));

    return services; }

    //this is my serviceCollectionimpl class import 'package:flutter_simple_dependency_injection/injector.dart';

    class ServiceCollectionImpl implements IServiceCollection { static const String _INJECTOR_NAME = "@pressy/injector";

    Injector _injector = Injector.getInjector(_INJECTOR_NAME);

    @override void addSingleton(ServiceFactory factory, {String key}) => injector.map(() => factory(this), isSingleton: true, key: key);

    @override void addScoped(ServiceFactory factory, {String key}) => injector.map(() => factory(this), key: key);

    @override void addInstance(IService instance, {String key}) { injector.map(() => instance, isSingleton: true, key: key); }

    @override IService getService({String key}) => _injector.get(key: key); }

    opened by Dr-Legend 3
  • Questions about the lib.

    Questions about the lib.

    Hi! Thanks for a great lib, I wanted to know:

    1. Can I make logic similar to Dagger2/Koin scoped features? In my code below all the modules will be created at one time, even if I don't need them. Some kind of lazy load would be great.
    2. Also can I clear module that I don't need now? For example, I have passed the registration screen, so I don't need any registration dependencies any more, can I clear them some how?
    3. As you can see insted of using mapWithParams with string variable name (which is ureliable in case I will change variable name). I am using map and passing object from the same (or other) injector.
    class DiContainer {
        DiContainer._privateConstructor();
    
      static final DiContainer _instance = DiContainer._privateConstructor();
    
      static DiContainer get instance => _instance;
    
      final Injector _mAppInjector = Injector();
      final Injector _mSpotListInjector = Injector();
      Injector mAppInjector;
      Injector mSpotListInjector;
    
      init() {
        mAppInjector = AppModuleContainer().initialise(_instance._mAppInjector);
        mSpotListInjector = SpotListModuleContainer().initialise(Injector(), _instance._mSpotListInjector);
      }
    }
    
    class AppModuleContainer {
      Injector initialise(Injector injector) {
        injector.map<AppPreferencesRepository>((injector) => AppPreferencesRepositoryImpl(), isSingleton: true);
        injector.map<ReportsRetrofitService>((injector) => createReportsService(), isSingleton: true);
    
        // // note that you can configure mapping in a fluent programming style too
        // injector.map<SomeType>((injector) => SomeType("0"))
        //   ..map<SomeType>((injector) => SomeType("1"), key: "One")
        //   ..map<SomeType>((injector) => SomeType("2"), key: "Two");
        //
        // injector.mapWithParams<SomeOtherType>((i, p) => SomeOtherType(p["id"]));
    
        return injector;
      }
    }
    
    class SpotListModuleContainer {
      Injector initialise(Injector injector, Injector appModuleInjector) {
        injector.map<ReportsRepository>((injector) => ReportsRepositoryImpl(appModuleInjector.get<ReportsRetrofitService>()));
    
        // // note that you can configure mapping in a fluent programming style too
        // injector.map<SomeType>((injector) => SomeType("0"))
        //   ..map<SomeType>((injector) => SomeType("1"), key: "One")
        //   ..map<SomeType>((injector) => SomeType("2"), key: "Two");
        //
        // injector.mapWithParams<SomeOtherType>((i, p) => SomeOtherType(p["id"]));
    
        return injector;
      }
    }
    
    opened by Turbozanik 2
  • Benchmarking

    Benchmarking

    Hi. I did some benchmarking of FSDI. I was hoping to get in contact with @jonsamwell

    HMU on Twitter or whatever and I'll send you the stuff I did.

    Cheers

    opened by MelbourneDeveloper 1
Releases(2.0.0)
  • 2.0.0(Apr 14, 2021)

    [2.0.0] - 15/04/2021

    • Stable null safety release
    • BREAKING CHANGE: the deprecated method Injector.getInjector() has now been removed in favour of the factory constructor.
    • Added the ability to allow the injector mapping to be reassigned at runtime using the parameter allowFutureReassignment
    Source code(tar.gz)
    Source code(zip)
  • 1.0.4(Oct 26, 2020)

    [1.0.4] - 26/10/2020

    • Various code optimizations.
    • Api now allows for method chaining so make mapping more concise.
    • Silent removing of non existing mappings (without throwing exceptions).
    • The Injector class now has a factory constructor. An Injector instance can be instantiated in a more concise way than Injector.getInjector() which is now marked as deprecated.
        // example with introduced changes
        final injector = Injector();
        injector.map<SomeType>((injector) => SomeType("0"))
                ..map<SomeType>((injector) => SomeType("1"), key: "One")
                ..map<SomeType>((injector) => SomeType("2"), key: "Two");
    
    Source code(tar.gz)
    Source code(zip)
  • 1.0.3(Aug 11, 2020)

Owner
Jon Samwell
Full-stack developer (frontend & Flutter specialist) with key interests in user experience, security, and end-to-end testing
Jon Samwell
A Dart dependency injection library aimed to be flexible, predictable and easy to use.

dino Dino is a Dart dependency injection library with optional code generation. It was inspired by DI in .NET and aimed to be flexible, predictable an

null 3 Dec 20, 2022
Flutter getx template - A Flutter Template using GetX package for State management, routing and Dependency Injection

Flutter GetX Template (GetX, Dio, MVVM) This Flutter Template using GetX package

Tareq Islam 6 Aug 27, 2022
MVC pattern for flutter. Works as state management, dependency injection and service locator.

MVC pattern for flutter. Works as state management, dependency injection and service locator. Model View Controller Here's a diagram describing the fl

xamantra 115 Dec 12, 2022
Arisprovider - A mixture between dependency injection (DI) and state management, built with widgets for widgets

A mixture between dependency injection (DI) and state management, built with wid

Behruz Hurramov 1 Jan 9, 2022
[Flutter SDK V.2] - Youtube Video is a Flutter application built to demonstrate the use of Modern development tools with best practices implementation like Clean Architecture, Modularization, Dependency Injection, BLoC, etc.

[Flutter SDK V.2] - Youtube Video is a Flutter application built to demonstrate the use of Modern development tools with best practices implementation like Clean Architecture, Modularization, Dependency Injection, BLoC, etc.

R. Rifa Fauzi Komara 17 Jan 2, 2023
Raden Saleh 20 Aug 12, 2023
Clean Architecture + TDD + SOLID + Dependency Injection + GitFlow + Mobx

Clean Architecture + TDD + SOLID + Dependency Injection + GitFlow + Mobx Flutter Interview Challenge This app is part of an interview process. It took

Vinicius Souza 13 Dec 28, 2022
A zero-dependency web framework for writing web apps in plain Dart.

Rad Rad is a frontend framework for creating fast and interactive web apps using Dart. It's inspired from Flutter and shares same programming paradigm

null 70 Dec 13, 2022
Web checkout dependency for stripe

Stripe Checkout For Flutter The quickest way to build conversion-optimized payment forms, hosted on Stripe. final sessionId = await getSessionIdFromMy

Mofidul Islam 3 Jun 2, 2022
This is Dependency package used for chating system.

This Package will give you a unique and pre-designed chatting system based on Firebase Firestore and Firebase Cloud. It also has Push Notifications an

AppTex Software Solutions 4 Oct 31, 2022
Flutter simple image crop - A simple and easy to use flutter plugin to crop image on iOS and Android

Image Zoom and Cropping plugin for Flutter A simple and easy used flutter plugin to crop image on iOS and Android. Installation Add simple_image_crop

null 97 Dec 14, 2021
Flutter Counter is a plugin written in dart for flutter which is really simple and customizeable.

Flutter Counter (iOS & Android) Description Flutter Counter is a plugin written in dart for flutter which is really simple and customizeable. Create i

Salmaan Ahmed 15 Sep 18, 2022
Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.

Flutter permission_handler plugin The Flutter permission_handler plugin is build following the federated plugin architecture. A detailed explanation o

Baseflow 1.7k Dec 31, 2022
Unloc customizations of the Permission plugin for Flutter. This plugin provides an API to request and check permissions.

Flutter Permission handler Plugin A permissions plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check perm

Unloc 1 Nov 26, 2020
Klutter plugin makes it possible to write a Flutter plugin for both Android and iOS using Kotlin only.

The Klutter Framework makes it possible to write a Flutter plugin for both Android and iOS using Kotlin Multiplatform. Instead of writing platform spe

Gillian 33 Dec 18, 2022
A Flutter step_tracker plugin is collect information from user and display progress through a sequence of steps. this plugin also have privilege for fully customization from user side. like flipkart, amazon, myntra, meesho.

step_tracker plugin A Flutter step_tracker plugin is collect information from user and display progress through a sequence of steps. this plugin also

Roshan nahak 5 Oct 21, 2022
dna, dart native access. A lightweight dart to native super channel plugin

dna, dart native access. A lightweight dart to native super channel plugin, You can use it to invoke any native code directly in contextual and chained dart code.

Assuner 14 Jul 11, 2022