Git Product home page Git Product logo

Comments (9)

Salakar avatar Salakar commented on September 26, 2024 7

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

from flutterfire_desktop.

barbalex avatar barbalex commented on September 26, 2024 3

Or even more flexible:

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

from flutterfire_desktop.

pr-Mais avatar pr-Mais commented on September 26, 2024

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

from flutterfire_desktop.

barbalex avatar barbalex commented on September 26, 2024

@Salakar works. Thanks a lot!

from flutterfire_desktop.

masus04 avatar masus04 commented on September 26, 2024

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,
);

from flutterfire_desktop.

pr-Mais avatar pr-Mais commented on September 26, 2024

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.

from flutterfire_desktop.

szho42 avatar szho42 commented on September 26, 2024

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

from flutterfire_desktop.

 avatar commented on September 26, 2024

Have you taken a look at this package?

https://pub.dev/packages/firebase_core_desktop

from flutterfire_desktop.

szho42 avatar szho42 commented on September 26, 2024

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)

from flutterfire_desktop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.