Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DefaultFirebaseOptions are not supported for this platform #41

Closed
barbalex opened this issue Jan 6, 2022 · 9 comments
Closed

DefaultFirebaseOptions are not supported for this platform #41

barbalex opened this issue Jan 6, 2022 · 9 comments

Comments

@barbalex
Copy link

barbalex commented Jan 6, 2022

After running into #19 and having to install the cli, create firebase_options.dart and add options: DefaultFirebaseOptions.currentPlatform when initializing the firebase App, I now run into this error:

Exception has occurred.
UnsupportedError (Unsupported operation: DefaultFirebaseOptions are not supported for this platform.)

Could this have something to do with the fact that windows can't be added as a platform on https://console.firebase.google.com?
2022-01-06_18h34_06

@pr-Mais
Copy link
Contributor

pr-Mais commented Jan 6, 2022

Windows and Linux aren't supported in Firebase Console.
Currently since the desktop packages under the hood use Identity Platform REST API, Web configurations can be used, but considering the CLI seems to be reading the current platform so it throws this exception.

@Salakar this is interesting case to think about for FF desktop

@Salakar
Copy link
Member

Salakar commented Jan 6, 2022

Yep the current recommendation is to select web as a platform to generate the DefaultFirebaseOptions for, and then instead of DefaultFirebaseOptions.currentPlatform you can use DefaultFirebaseOptions.web

@barbalex
Copy link
Author

barbalex commented Jan 6, 2022

@Salakar works. Thanks a lot!

@pr-Mais pr-Mais closed this as completed Jan 9, 2022
@masus04
Copy link

masus04 commented Jan 24, 2022

Yep the current recommendation is to select web as a platform to generate the DefaultFirebaseOptions for, and then instead of DefaultFirebaseOptions.currentPlatform you can use DefaultFirebaseOptions.web

Can you elaborate on this?

My current Firebase initialization looks like this:

// Init Firebase
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
  options: Platform.isLinux ? DefaultFirebaseOptions.web : DefaultFirebaseOptions.currentPlatform,
);

@barbalex
Copy link
Author

Or even more flexible:

bool needsWeb = Platform.isLinux | Platform.isWindows;
await Firebase.initializeApp(
  options: needsWeb
      ? DefaultFirebaseOptions.web
      : DefaultFirebaseOptions.currentPlatform,
);

@pr-Mais
Copy link
Contributor

pr-Mais commented Jan 24, 2022

Just to clarify, macOS is included, as mentioned in the README

the plugin will override macOS implementation as it's currently being used for development purposes.

sdresselmann pushed a commit to sdresselmann/Herculade that referenced this issue Aug 1, 2022
Reason for that is that windows (and linux) are not supported by flutter fire plugin:
FirebaseExtended/flutterfire_desktop#41
@szho42
Copy link

szho42 commented Aug 1, 2023

Hi, all, tried the solutions mentioned in this solution, but it does not work for flutter apps (for linux) with flutter version (3.10.6 - stable), firebase_core (2.15.0) and cloud_firestore (4.8.4).

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)
#0 FirebaseCoreHostApi.initializeCore (package:firebase_core_platform_interface/src/pigeon/messages.pigeon.dart:210)

#1 MethodChannelFirebase._initializeCore (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:29)

#2 MethodChannelFirebase.initializeApp (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:73)

#3 Firebase.initializeApp (package:firebase_core/src/firebase.dart:43)

Just wondering any timeline to officially support this for Linux/Windows?

Cheers

@ghost
Copy link

ghost commented Aug 1, 2023

Have you taken a look at this package?

https://pub.dev/packages/firebase_core_desktop

@szho42
Copy link

szho42 commented Aug 1, 2023

I tried with firebase_core_desktop, the UI can be displayed on Linux, however, it failed to fetch data from firestore. the function snapshots() won't be able to be called. See the message below:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method Query#snapshots on channel plugins.flutter.io/firebase_firestore)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:308:7)

#1 MethodChannelQuery.snapshots. (package:cloud_firestore_platform_interface/src/method_channel/method_channel_query.dart:150:28)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants