Dartblaze allows you to write Firebase Cloud Functions in pure Dart, bringing type safety, language, ecosystem, and packages you already know and love from Flutter to the backend.
Important
Dartblaze has been discontinued as the Dart team started to work on Dart Cloud Functions for Firebase.
- dartblaze - Core parts fo the framework
- dartblaze_builder - Code generator for the framework
- dartblaze_shared - Shared parts of the framework
See docs to install the CLI and get started.
Write your cloud functions using the same syntax as in Node:
@OnDocumentCreated('todos/{todoId}')
Future<void> oncreatetodo(
DocumentSnapshot snapshot,
RequestContext context,
{required String todoId}
) async {
final data = snapshot.data();
final title = data?['title'] as String?;
await snapshot.ref.update({'title': '$title from server!'});
}Then, run the generator dart run build_runner build --delete-conflicting-output to generate the necessary code.
Finally, deploy using the CLI:
dartblaze deploy <function_name> --region=<region>See docs for more info.