小编Mad*_*ami的帖子

Object/factory with type NavigationService is not registered inside GetIt

This error keeps coming in my development

Debug Console

[ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: 'package:get_it/get_it_impl.dart': Failed assertion: line 312 pos 7: 'instanceFactory != null': Object/factory with  type NavigationService is not registered inside GetIt.
E/flutter (27190): (Did you accidentally do GetIt sl=GetIt.instance(); instead of GetIt sl=GetIt.instance;
E/flutter (27190): Did you forget to register it?)

Run Code Online (Sandbox Code Playgroud)

This is the navigator service file in which the navigation service as well as getit is initialised

navigation_service.dart

GetIt locator = GetIt.instance;

setupLocator() {
  locator.registerLazySingleton(() => NavigationService());
}

class …
Run Code Online (Sandbox Code Playgroud)

dart flutter flutter-navigation

5
推荐指数
1
解决办法
6850
查看次数

标签 统计

dart ×1

flutter ×1

flutter-navigation ×1