I was following a tutorial on YouTube about a year old by now and followed the instructions that the guy in the video gave me to install firebase and it seems to be working just fine until I run the following lines of script in my lib/main.dart
file
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}
It kept returning a type error which I could understand how to solve, i tried removing the await, and many such things but to no avail. the exact error I got was,
_TypeError (type '_Map<Object?, Object?>' is not a subtype of type 'List<Object?>' in type cast)
I tried running the app without the firebase stuff and it worked just fine I also tried the example in the firebase_core 3.3.0 example but it still didn’t work when I pressed the first button on my screen. In the beginning it wouldn’t even build the apk properly and i had to manually copy the exact pubspec.yaml of the guy whose tutorial I followed, that did work in me finally getting a working apk but the firebase connection still didn’t occur. I would really appreciate an easy to follow answer, if possible, as I am a beginner at flutter. If you need any more information in order to help me, please feel free to ask.
BTW I am using Visual studio and not Android Studio if that makes any difference.
Gaurav Paul is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.