gbtb16 / kiwi

A simple compile-time dependency injection library for Dart and Flutter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

inject firebase and GoogleSignIn

camh3190 opened this issue · comments

Hi!
I'm trying to inject a FirebaseAuth and GoogleSignIn instance but I just can not figure out how to do it
If I use :
@Register.singleton(FirebaseAuth)
the injector.g.dart it is not created and get this error in the terminal:
Error running InjectorGenerator
Invalid argument(s): the constructor FirebaseAuth.null does not exist

I'm using this tutorial as reference: https://bloclibrary.dev/#/flutterfirebaselogintutorial?id=app

Untested, use at your own risk: container.registerInstance(FirebaseAuth.instance);

thanks !!!! it works.
And for the record, if someone checks the tutorial I'm using as reference, I have to use:
container.registerInstance(FirebaseAuth.instance); container.registerInstance(GoogleSignIn());

I just hope it does not give me an unexpected error in the future jajajaja

@camh3190 this is indeed the correct way for registering something like this.