google_cloud_firestore 0.5.1 copy "google_cloud_firestore: ^0.5.1" to clipboard
google_cloud_firestore: ^0.5.1 copied to clipboard

A Dart client library for Google Cloud Firestore, a flexible, scalable database for mobile, web, and server development from Firebase and Google Cloud.

example/main.dart

// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import 'package:google_cloud_firestore/google_cloud_firestore.dart';

void main() async {
  // By default, the `Firestore` class will use the currently configured project
  // and automatically attempt to authenticate using Application Default
  // Credentials.
  final firestore = Firestore();

  final users = firestore.collection('users');

  await users.doc('ada-lovelace').set({
    'first': 'Ada',
    'last': 'Lovelace',
    'born': 1815,
  });
  await users.doc('george-boole').set({
    'first': 'George',
    'last': 'Boole',
    'born': 1815,
  });
  await users.doc('grace-hopper').set({
    'first': 'Grace',
    'last': 'Hopper',
    'born': 1906,
  });

  final query = users.where('born', WhereFilter.lessThan, 1900);
  final querySnapshot = await query.get();
  print('Found ${querySnapshot.size} matching people:');
  for (final doc in querySnapshot.docs) {
    final data = doc.data();
    print(' - ${data['first']} ${data['last']}');
  }
}
6
likes
160
points
2.36k
downloads

Documentation

API reference

Publisher

verified publisherfirebase.google.com

Weekly Downloads

A Dart client library for Google Cloud Firestore, a flexible, scalable database for mobile, web, and server development from Firebase and Google Cloud.

Repository (GitHub)
View/report issues
Contributing

License

Apache-2.0 (license)

Dependencies

collection, google_cloud, googleapis, googleapis_auth, http, intl, meta

More

Packages that depend on google_cloud_firestore