You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One of the people that I work with had an issue and cant keep working on a project, and now I have to finish it.
This project uses Flutter Web and Get_it (besides other packages) and I'm trying to understand how it works
But when I try to run it i have this error
"No type Api is registered inside GetIt.\n Did you forget to pass an instance name? \n(Did you accidentally do GetIt sl=GetIt.instance(); instead of GetIt sl=GetIt.instance;\ndid you forget to register it?)"
@lazySingleton
class ConfigLoader {
ColorModel colors;
@factoryMethod
static Future<ConfigLoader> load() async {
final Api api = getIt<Api>(); ----> HERE IS THE PROBLEM
final ConfigLoader loader = ConfigLoader();
final Response<dynamic> response = await api.client.get('/loadConfig.json');
if(response.data != null){
loader.colors = ConfigyModel.fromMap(response.data).colors;
}
return loader;
}
}
I think the problem is when I make GetIt(), the system searches for Api but it "has not been " registered.
Hi!
One of the people that I work with had an issue and cant keep working on a project, and now I have to finish it.
This project uses Flutter Web and Get_it (besides other packages) and I'm trying to understand how it works
But when I try to run it i have this error
"No type Api is registered inside GetIt.\n Did you forget to pass an instance name? \n(Did you accidentally do GetIt sl=GetIt.instance(); instead of GetIt sl=GetIt.instance;\ndid you forget to register it?)"
From what I can understand, the flow goes...
Main.dart
injectable.dart
ConfigLoader.dart
I think the problem is when I make GetIt(), the system searches for Api but it "has not been " registered.
But when I took a look at this generated file
From what is see here, the Api class has been registered (Api is an abstract class)
Can someone help me?
The text was updated successfully, but these errors were encountered: