firebase_js_interop
0.0.12, released 9 months ago by iodesignteam.com
Dart wrappers to write Firebase Cloud Functions
What it does
Provides JS interop for Firebase Admin and Functions, enabling Dart code to compile to JavaScript for Cloud Functions. It supports full interop for Firestore, HTTPS, and Identity services, with partial support for Admin Database and limited messaging.
AI-written summary of version 0.0.12, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to write Cloud Functions in Dart instead of JavaScript/TypeScript
- You need full interop for Firestore, HTTPS, or Identity functions
- You are building a Dart-only project that also deploys Cloud Functions
Skip it when
- You only need Firebase services on the client side
- You require Auth, Storage, or other services not yet supported
- You prefer to stay in TypeScript/JavaScript for Cloud Functions
Strengths
- Full interop for Firestore, HTTPS, Identity
- Build tool that compiles Dart to JS for Cloud Functions
- Supports Admin Database interop
- Clear documentation and examples
Weaknesses
- Limited interop for many services (Auth, Storage, Messaging only partial)
- Requires manual setup of firebase tools and build scripts
- No support for non-web platforms
Setup
- Kind
- Pure Dart
- Effort
- Medium
- Code generation
- Yes (build_runner)
- Direct dependencies
- 3
Install firebase tools, add firebase.json ignores, create build.dart, run dart run tool/build.dart, then firebase deploy. No build_runner needed.
import 'dart:js_interop';
import 'package:firebase_js_interop/functions.dart';
import 'package:firebase_js_interop/express.dart' as express;
void main() {
exports['helloWorld'] = FirebaseFunctions.https.onRequest(
(Request request, express.Response response) {
return response.send('Hello from Firebase!'.toJS);
}.toJS,
);
}Alternatives
Packages that do the same job and could replace firebase_js_interop.
- cloud_functions_web
Web implementation of Firebase Cloud Functions for Flutter web apps
78Compare - cloud_functions
Flutter plugin for using the Cloud Functions for Firebase API.
96Compare - firebase_core_web
Web implementation of firebase_core for Flutter apps.
83Compare - cloud_firestore_web
The web implementation of cloud_firestore.
82Compare
Works with
Packages commonly used together with firebase_js_interop: ones it builds on, ones built on it, and its own family.
- json_annotationfirebase_js_interop depends on itProvides annotations for json_serializable to generate JSON (de)serialization code.
- node_preamblefirebase_js_interop depends on itProvides a node.js preamble for dart2js output to improve compatibility with Node, Webpack and Electron.
- firebase_rulesSame familyA type-safe Firebase rules generator for Firestore, Storage, and Realtime Database