skip to Main Content

I am developing an app with flutter. I plan to support Android, iOS, macOS, and windows.
But I found that Firebase doesn’t work for mac os.

In flutterfire, I chose the following platforms:
✔ Which platforms should your configuration support (use arrow keys & space to select)? · android, ios, macos

But when I ran flutter build -d macos, I got the error “DefaultFirebaseOptions have not been configured for macos”.

3

Answers


  1. Try setting up firebase for macOS using the non flutter fire method – manually downloading a configuration file when you add the macOS app on firebase and including that in your XcodeWorkSpace file.

    https://firebase.flutter.dev/docs/manual-installation/macos/

    Login or Signup to reply.
  2. you have to add this code inside your void main(), just after WidgetsFlutterBinding.ensureInitialized();

     await Firebase.initializeApp(
          options: DefaultFirebaseOptions.currentPlatform,
        );
    Login or Signup to reply.
  3. You need to give your MacOS app Internet access by adding the following to your DebugProfile.entitlements file and Release.entitlements file in your macOS/Runner directory:

    <key>com.apple.security.network.client</key>
    <true/>
    

    I can’t tell you how long it took me to figure this out.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search