Building full-stack applications often requires using one language for the client, such as Dart for Flutter, and another for the backend, such as TypeScript, Go, or Python. This separation requires you to maintain two codebases and duplicate business logic and data models across your stack.
At Cloud Next, we announced experimental support for Dart in Cloud Functions for Firebase. You can now use the same language and tooling across your whole stack when building applications with Flutter, Dart, and Firebase.
A unified development experience
Using Dart on both the client and server reduces the need to switch contexts between different languages and their respective concurrency models, configurations, and type systems. You can write your backend logic with the same expressive, null-safe language you use for your Flutter frontend. Additionally, by sharing data models and validation rules in a common Dart package, you can ensure your frontend and backend stay synchronized.
Reduce cold start times with AOT compilation
Dart’s Ahead-of-Time (AOT) compilation compiles your code into native binaries. Unlike runtimes that rely on Just-In-Time (JIT) compilation or heavy virtual machines, Dart binaries execute immediately without a warm-up period.
This significantly reduces cold start times for serverless environments. Because you only pay for compute when your function runs, leaner binaries and faster execution times can help lower your infrastructure costs.
Asynchronous I/O
Most serverless functions are I/O-bound, meaning they spend time waiting for database queries, API responses, or network requests. Dart’s asynchronous, event-driven architecture handles this efficiently without requiring large thread pools. Cloud Functions for Firebase automatically scales concurrent, lightweight instances to handle the incoming load.
Deploy and test your code
Native Dart support integrates directly with the Firebase tools you already use.
Deploy with the Firebase CLI
You don’t need to write custom Dockerfiles or manage container registries to deploy your code. You can deploy your Dart backend using the standard Firebase CLI:
firebase deploy --only functions
The Firebase CLI handles the compilation and deployment to Google Cloud infrastructure.
Test locally with the Firebase Emulator Suite
The Firebase Emulator Suite provides a complete local environment to test your Dart functions offline. You can test your end-to-end application, including your database and backend logic, before deploying to production.
The Emulator Suite even watches your function source and reloads emulated functions after you make a change, meaning you can develop with the same quick development loop that Flutter allows when you’re working on your client app.
firebase emulators:start
A new Admin SDK
The Firebase Admin SDK is a set of server libraries that lets you interact with Firebase from server environments. Alongside support for Dart in Cloud Functions for Firebase, we also released an experimental Dart Admin SDK at Cloud Next.
The Dart Admin SDK is automatically initialized in Cloud Functions for Firebase, so you can read from and write to services like Firestore without any additional setup.
Plus, if you’d rather run your Dart server code on Cloud Run, Compute Engine, or your own computer, you can add the Admin SDK from pub.dev yourself. This opens up Dart and Firebase on any server environment.
Write your first Dart function
Writing a function in Dart uses the firebase_functions package. The following example demonstrates how to implement an https request handler that fetches a greeting message from Firestore with the Admin SDK:
import 'package:firebase_functions/firebase_functions.dart';
void main(List<String> args) {
fireUp(args, (firebase) {
firebase.https.onRequest(
name: 'helloWorld',
options: const HttpsOptions(cors: Cors(['*'])),
(request) async {
// Read a greeting from Firestore with the Dart Admin SDK
final greetingSnapshot = await firebase.adminApp
.firestore()
.collection('greetings')
.doc('english')
.get();
final greeting = greetingSnapshot.data()?['message'] ?? 'Hello';
return Response(200, body: '${greeting} from Dart Functions!');
},
);
});
} Try it out
Native Dart support is currently an experimental feature behind a flag in the Firebase CLI. This initial release supports HTTPS and callable functions, which provide the essential building blocks for secure backend logic.
To try out this experimental release, follow the getting started guide or jump straight into the codelab. Share your feedback or feature requests on GitHub. We look forward to seeing what you build!


