Skip to content
pubscout

firebase_js_interop

0.0.12, released 9 months ago by iodesignteam.com

Dart wrappers to write Firebase Cloud Functions

WASM-ready
$ flutter pub add firebase_js_interop
Source repository

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.

Works with

Packages commonly used together with firebase_js_interop: ones it builds on, ones built on it, and its own family.