26

I was thinking of developing a desktop application with Dart and Flutter, but I don't know how can I integrate a Firebase database with it.

0

5 Answers 5

15

Use Firedart package to integrate FIrebase to Desktop-based Flutter apps.

https://pub.dev/packages/firedart

Documentation Says

This library attempts to minimize dependencies with the intention of making it able to run in any environment capable of executing dart code. Currently it has been successfully tested using the dart runtime (x86-64 and arm32) as well as on Flutter Android, iOS and Desktop.

Sign up to request clarification or add additional context in comments.

2 Comments

Doesnt seem to be currently working. Following the example code in the docs I get an error Handling error gRPC Error (code: 1, codeName: CANCELLED, message: Disconnecting idle stream. Timed out waiting for new targets
Better write a new question instead of commenting. As the error is irrelevant to this issue.
8

Context: As of 24/02/2021 the main project for supporting firebase services in Flutter can be found here. If you look at this issue raised on GitHub it provides a rough roadmap for the project which is looking at the "possibility" of supporting desktop.

An issue has been opened to provide support for Windows and Linux.

Answer: Right now the best options to use Firebase with your desktop application is to either -

  1. Read the documentation for each firebase service and see if they support RESTful API requests to interact with the service. For example Cloud Firestore supports this.
  2. firedart is an open source attempt to provide an API for some Firebase services.
  3. Wait for ("hopefully") Google to provide a package written natively in dart.

5 Comments

The issue is now a discussion (feature request) github.com/FirebaseExtended/flutterfire/discussions/5557
I am writing a Windows desktop app in Flutter, that shares much code with a mobile phone app that runs nicely, and on Firebase.initializeApp I get the infamous "missingpluginexception(no implementation found for method firebase#initializecore on channel plugins.flutter.io/firebase_core)" error. And apparently this happens because Windows is not yet supported. I tried to switch to firedart, that is quite nice, but it does not support FirebaseStorage, i.e. storage of files, especially images. Auth and Firebase DB work fine, though, with minor code changes. Will wait for Windows support.
@MichaelUhlenberg Have you used FirebaseStorage on Desktop?
@Deepak sharma: do you mean pub.dev/packages?q=firebasestorage ? No. Does not work on Windows. I looked again right now and it seems nothing has changed yet. I wonder if there are any principal reasons why Windows is not supported.
Hi, for anyone who is interested in the official flutterfire desktop. please upvote for the feature request in the link below. thanx! firebase.uservoice.com/forums/948424-general/suggestions/…
5

The main FlutterFire page has a table that shows what Firebase products work in which environment.

Right now that shows that these products are supported in macOS desktop apps:

  • Cloud Firestore
  • Cloud Functions
  • Firebase Authentication
  • Firebase Crashlytics
  • Firebase Storage

If you're having problems making one of these work, edit your question to include the minimal information with which we can reproduce where you got stuck and any error messages you're getting.

5 Comments

Can I use these products in windows app?
The documentation I linked only mentions macOS, and the main Flutter desktop documentation also says that Windows and Linux are under even more active development. On the other hand, posts such as this one show that some folks have gotten a Flutter app working on Windows. If you are having problems getting it to work, post what you've tried and where you got stuck and somebody may try to help.
None of the FlutterFire plugins support Windows or Linux; that's why only macOS is listed in the chart.
Have you checked firedart . pub.dev/packages/firedart In the documentation, it says that the package can be used in any dart based apps.
@FathahKodag I looked through my entire browser history so I could find this comment again. I needed to use Firestore on Flutter - Windows, and firedart worked for me. Thanks a lot!
3

I connect Firebase with my windows flutter app using http method; code and snapshot are below. Firebase real time database work perfectly. i follow this tutorial https://medium.com/flutterdevs/http-request-dcc13e885985

my code is:

import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: new MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => new _MyHomePageState();
}



class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
    sendData();
  }

  sendData() {
    http.post(
        Uri.parse(
            "https://rest-12bb2-default-rtdb.firebaseio.com/userprofile.json"),
        body: json.encode({
          'firstName': "b",
          'lastName': "c",
          'email': "f",
        }));
    // setState(() {
    //   userProfile.add(Profile(
    //     firstName: firstname;
    //     lastName: lastname;
    //     email: email;
    //   ));
    // });
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text("app"),
      ),
      body: new Center(
        child: new Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            new Text(
              'You have pushed the button this many times:',
            ),
            new Text(
              '$_counter',
              style: Theme.of(context).textTheme.display1,
            ),
          ],
        ),
      ),
      floatingActionButton: new FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: new Icon(Icons.add),
      ),
    );
  }
}

///////////// firebase snapshotenter image description here

Comments

-1

you can use Firebase C++ SDK :

https://firebase.google.com/docs/cpp/setup#desktop-workflow

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.