firebase_admin_interop library

Firebase Admin Interop Library for Dart.

This is a JS interop library so it can't be used standalone. It must be compiled to JavaScript as a valid Node module and import official Node.js Admin SDK for Firebase.

Main entry point to this library is FirebaseAdmin class. It is a higher level interface on top of JS bindings which abstracts away some details of interacting with JavaScript and Node.js APIs.

It is still possible to use JS bindings directly by importing "js.dart":

import 'package:firebase_admin_interop/js.dart';

Below is a quick start example of working with the Realtime Database API:

import 'dart:async';
import 'package:firebase_admin_interop/firebase_admin_interop.dart';

Future main() async {
  var admin = FirebaseAdmin.instance;
  var cert = admin.certFromPath(serviceAccountKeyFilename);
  var app = admin.initializeApp(new AppOptions(
    credential: cert,
    databaseUrl: "YOUR_DB_URL",
  ));
  var ref = app.database().ref('/test-path');
  // Write value to the database at "/test-path" location.
  await ref.setValue("Hello world");
  // Read value from the same database location.
  var snapshot = ref.once("value");
  print(snapshot.val());
}

See also:

Classes

AndroidConfig
Represents the Android-specific options that can be included in an admin.messaging.Message.
AndroidFcmOptions
Represents options for features provided by the FCM SDK for Android.
AndroidNotification
Represents the Android-specific notification options that can be included in admin.messaging.AndroidConfig.
ApnsConfig
Represents the APNs-specific options that can be included in an admin.messaging.Message.
ApnsFcmOptions
Represents options for features provided by the FCM SDK for iOS.
ApnsPayload
Represents options for features provided by the FCM SDK for iOS.
App
Represents initialized Firebase application and provides access to the app's services.
AppOptions
Available options to pass to initializeApp.
Aps
Represents the aps dictionary that is part of APNs messages.
ApsAlert
Auth
BatchResponse
Interface representing the server response from the sendAll() and sendMulticast() methods.
Blob
An immutable object representing an array of bytes.
CollectionReference
A CollectionReference object can be used for adding documents, getting document references, and querying for documents (using the methods inherited from DocumentQuery).
ConditionMessage
CreateUserRequest
CriticalSound
Represents a critical sound configuration that can be included in the aps dictionary of an APNs payload.
Database
Firebase Realtime Database service.
DatabaseTransaction
Firebase Realtime Database transaction result returned from Reference.transaction.
DataMessagePayload
Interface representing an FCM legacy API data message payload. [...]
DataSnapshot<T>
A DataSnapshot contains data from a Database location. [...]
DecodedIdToken
Interface representing a decoded Firebase ID token, returned from the Auth.verifyIdToken method.
DocumentChange
A DocumentChange represents a change to the documents matching a query. [...]
DocumentData
Data stored in a Firestore Document. [...]
DocumentQuery
Represents a query over the data at a particular location.
DocumentReference
A DocumentReference refers to a document location in a Firestore database and can be used to write, read, or listen to the location. [...]
DocumentSnapshot
EventType
List of event types supported in Query.on and Query.off.
FcmMessage
FcmOptions
Options for features provided by the FCM SDK for Web.
FieldValue
Sentinel values that can be used when writing document fields with set() or update().
FieldValues
FirebaseAdmin
Provides access to Firebase Admin APIs. [...]
FirebaseSignInInfo
Firestore
Represents a Firestore Database and is the entry point for all Firestore operations.
FirestoreSettings
FutureReference
A special Reference which notifies when it's written to the database. [...]
GeoPoint
Represents Firestore geo point object.
ListUsersResult
Interface representing a resulting object returned from a Auth.listUsers operation containing the list of users for the current batch and the next page token if available.
Messaging
MessagingConditionResponse
Interface representing the server response from the legacy sendToCondition() method.
MessagingDeviceGroupResponse
Interface representing the server response from the sendToDeviceGroup() method.
MessagingDeviceResult
Interface representing the status of a message sent to an individual device via the FCM legacy APIs.
MessagingDevicesResponse
Interface representing the server response from the legacy sendToDevice() method.
MessagingOptions
Interface representing the options that can be provided when sending a message via the FCM legacy APIs.
MessagingPayload
Interface representing a Firebase Cloud Messaging message payload. One or both of the data and notification keys are required.
MessagingTopicManagementResponse
Interface representing the server response from the subscribeToTopic() and admin.messaging.Messaging#unsubscribeFromTopic unsubscribeFromTopic() methods.
MessagingTopicResponse
Interface representing the server response from the legacy sendToTopic() method.
MulticastMessage
Notification
A notification that can be included in admin.messaging.Message.
NotificationMessagePayload
Interface representing an FCM legacy API notification message payload. Notification messages let developers send up to 4KB of predefined key-value pairs.
Query
Sorts and filters the data at a Database location so only a subset of the child data is included. [...]
QuerySnapshot
A QuerySnapshot contains zero or more DocumentSnapshot objects.
QuerySubscription
QuerySubscription to keep function callback and allowing use to unsubscribe with cancel later.
Reference
A Reference represents a specific location in your Database and can be used for reading or writing data to that Database location.
SendResponse
Interface representing the status of an individual message that was sent as part of a batch request.
SetOptions
An options object that configures the behavior of set() calls in DocumentReference, WriteBatch and Transaction. These calls can be configured to perform granular merges instead of overwriting the target documents in their entirety by providing a SetOptions with merge: true.
Timestamp
Represents Firestore timestamp object.
TokenMessage
TopicMessage
Transaction
A reference to a transaction. The Transaction object passed to a transaction's updateFunction provides the methods to read and write data within the transaction context. See Firestore.runTransaction.
TransactionResult<T>
Realtime Database transaction result returned from DatabaseTransactionHandler. [...]
UpdateData
Represents data to update in a Firestore document. [...]
UpdateUserRequest
UserInfo
Interface representing a user's info from a third-party identity provider such as Google or Facebook.
UserMetadata
UserRecord
Interface representing a user.
WebpushConfig
Represents the WebPush protocol options that can be included in an admin.messaging.Message.
WebpushFcmOptions
Represents options for features provided by the FCM SDK for Web (which are not part of the Webpush standard).
WebpushNotification
Represents the WebPush-specific notification options that can be included in admin.messaging.WebpushConfig.
WriteBatch
A write batch, used to perform multiple writes as a single atomic unit. [...]

Functions

createFieldPath(List<String> fieldNames) FieldPath
@Deprecated('This function will be hidden from public API in future versions.')
createGeoPoint(num latitude, num longitude) GeoPoint
@Deprecated('This function will be hidden from public API in future versions.')
documentId() FieldPath
Returns a special sentinel FieldPath to refer to the ID of a document. It can be used in queries to sort or filter by the document ID.
@Deprecated('Use "Firestore.documentId" instead.')

Enums

DocumentChangeType
An enumeration of document change types.

Typedefs

DatabaseTransactionHandler<T>(T currentData) TransactionResult<T>
Interface for a Realtime Database transaction handler function used in Reference.transaction.