How to properly register ObjectBox in GetIt? I have an error: The argument type 'Type' can't be assigned to the parameter type 'ObjectBox Function()'.
final injector = GetIt.instance;
class DependencyInitializer {
DependencyInitializer._();
static void initDependencies() {
injector
//DataBase
..registerLazySingleton<ObjectBox>(ObjectBox);
}
}
You have to pass a function/constructor that returns an instance. Passing 'ObjectBox' itself is just the type.
Try this: