app_module.dart 741 B

123456789101112131415161718192021222324
  1. import 'package:mvvm_flutter/model/remote.dart';
  2. import 'package:mvvm_flutter/model/repository.dart';
  3. import 'package:mvvm_flutter/viewmodel/home_provide.dart';
  4. import 'package:dartin/dartin.dart';
  5. const testScope = DartInScope('test');
  6. final viewModelModule = Module([
  7. factory<HomeProvide>(({params}) => HomeProvide(params.get(0), get<GithubRepo>())),
  8. ])
  9. ..addOthers(testScope, [
  10. ///other scope
  11. // factory<HomeProvide>(({params}) => HomeProvide(params.get(0), get<GithubRepo>())),
  12. ]);
  13. final repoModule = Module([
  14. lazy<GithubRepo>(({params}) => GithubRepo(get<GithubService>())),
  15. ]);
  16. final remoteModule = Module([
  17. single<GithubService>(GithubService()),
  18. ]);
  19. final appModule = [viewModelModule, repoModule, remoteModule];