cloud_firestore_vm 0.0.7

Dart native
Flutter Android iOS

Dart implementation of Cloud Firestore SDK that offers a cloud-hosted, noSQL database with live synchronization and offline support.

Firebase Firestore for Dart #

A Dart port of the Firebase Firestore SDK to use the Cloud Firestore API.

Note: This library is still under development, and some APIs might not be available yet or work correctly. Please feel free to open an issue here or even a pull requests if you feel brave.

Setup #

To use this plugin:

  1. Using the Firebase Console, add an Android app to your project: Follow the assistant, download the generated google-services.json file and place it inside android/app. Next, modify the android/build.gradle file and the android/app/build.gradle file to add the Google services plugin as described by the Firebase assistant. Ensure that your android/build.gradle file contains the maven.google.com as described here.
  2. Using the Firebase Console, add an iOS app to your project: Follow the assistant, download the generated GoogleService-Info.plist file, open ios/Runner.xcworkspace with Xcode, and within Xcode place the file inside ios/Runner. Don't follow the steps named "Add Firebase SDK" and "Add initialization code" in the Firebase assistant.
  3. Add firebase_firestore as a dependency in your pubspec.yaml file.

Usage #

import 'package:cloud_firestore/cloud_firestore.dart';

Adding a new DocumentReference:

FirebaseFirestore.instance
    .collection('books')
    .document()
    .set({'title': 'title', 'author': 'author'});

Performing a query:

FirebaseFirestore.instance
    .collection('talks')
    .whereEqualTo('topic', 'flutter')
    .snapshots
    .listen((data) => data.documents.forEach((doc) => print(doc['title'])));

Running a transaction:

final DocumentReference postRef = FirebaseFirestore.instance.document('posts/123');
FirebaseFirestore.instance.runTransaction((Transaction tx) async {
  final DocumentSnapshot postSnapshot = await tx.get(postRef);
  if (postSnapshot.exists) {
    tx.update(postRef, <String, dynamic>{
      'likesCount': postSnapshot.getInt('likesCount') + 1
    });
  }
});
0
likes
75
pub points
54%
popularity

Dart implementation of Cloud Firestore SDK that offers a cloud-hosted, noSQL database with live synchronization and offline support.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

lung.razvan@gmail.com

License

unknown (LICENSE)

Dependencies

_firebase_database_collection_vm, _firebase_internal_vm, async, collection, firebase_core_vm, fixnum, grpc, meta, path, pedantic, protobuf, rxdart, semaphore

More

Packages that depend on cloud_firestore_vm