The class 'FirebaseAnalytics' doesn't have an unnamed constructor

Viewed 26

I would like to use firebase analytics but keep getting this error, I upgrade and cleaned but still has the same error. any idea how I can solve it? thanks

static FirebaseAnalytics analytics = FirebaseAnalytics(); FirebaseAnalytics is underlined

1 Answers

I solve it by removing the parentheses and adding .instance.

static FirebaseAnalytics analytics = FirebaseAnalytics.instance;

see documentation. Thanks

Related