If I follow the flutterfire docs to install the flutterfire_core library and the realtime_db library, it seems I can connect to my remote firebase database when building for Chrome, but not for macOS (M1 2021 MB Pro).
The simplest example I can give you is this (myApp is unchanged from the default flutter create
):
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_database/firebase_database.dart';
import 'firebase_options.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
await FirebaseDatabase.instance.ref().update({
"name": "Derek",
}).then((_) {
print("hello");
})
.catchError((error) {
print("uhoh");
});
runApp(const MyApp());
}
This compiles with no errors on my local machine (neither macOS nor Chrome). When building for chrome, it was able to update the remote, but not when building for macOS (it just hangs, no UI is loaded, no print statements complete). (Along the way, I did update my macOS build settings to 10.15, because I was being yelled about having things set to 10.11. When I have tried this in the past, with 10.12, things didn't work either.)
What I have tried
I have also tried to clone the example here, and it "works" (with warnings) on my machine for the Chrome build but not the macOS build.
Thank you for any help you could send my way :-)
Output of flutter --version
:
Framework • revision fb57da5f94 (2 weeks ago) • 2022-05-19 15:50:29 -0700
Engine • revision caaafc5604
Tools • Dart 2.17.1 • DevTools 2.12.2
Output of flutterfire -v
0.2.2+2
Edit: Added emphasis to my main problem, and removed a warning message that has since been fixed by Rodrigo's comment.