'How do I perform Firestore admin tasks from a server-side Dart application?
I'm working on putting together a server-side Dart application that will run in App Engine. It needs to access a Firestore database, but I'm having trouble doing so.
The Dart packages I've tried are:
In both cases, I get errors like this when attempting to execute my code:
file:///root/.pub-cache/hosted/pub.dartlang.org/firebase_admin_interop-1.2.2/lib/src/database.dart:5:8: Error: Not found: 'dart:js'
import 'dart:js';
My vague understanding of this error is that it means the library has a dependency on running in a browser. However, I've not been able to find any way to interact with Firestore in a server-to-server configuration using Dart.
Is my only recourse here to use the Firestore REST API?
Solution 1:[1]
There is no Firebase Admin SDK for Dart. So indeed the REST API would be your best best.
Note that much of the Admin functionality is not exposed in documented REST API. So ymmv, and I'd seriously consider switching to a platform where you can use one of the official Admin SDKs.
Solution 2:[2]
If the number of search results on google are an indicator for popularity, then
Go, Node.js and C# are the languages most people use with the firestore admin libraries
Google searched input taken from https://cloud.google.com/firestore/docs/quickstart-servers
Go: "cloud.google.com/go/firestore" -> 3890 results
Node.js: "require('@google-cloud/firestore')" -> 2120 results
C#: "FirestoreDb.Create" -> 1110
Python: "from google.cloud import firestore" -> 859 results
Java: "import com.google.cloud.firestore.Firestore" -> 601 results
PHP: "Google\Cloud\Firestore\FirestoreClient" -> 1 result
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Frank van Puffelen |
| Solution 2 | David |
