firebase_functions_interop 0.0.1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 38

Firebase Functions Interop Library for Dart #

This library provides JS bindings for Firebase Functions Node SDK. It also exposes a convenience layer to simplify writing Cloud Functions applications in Dart.

Please note that it's currently a proof-of-concept-preview version so it lacks many features, tests and documentation. But, it's already fun to play with!

Usage #

Make sure you have Firebase CLI installed as well as a Firebase account and a test app. See Getting started for more details.

1. Create a new project directory and initialize functions: #

$ mkdir myproject
$ cd myproject
$ firebase init functions

This creates functions subdirectory in your project's root which contains standard NodeJS package structure with package.json and index.js files.

2. Initialize Dart project #

Go to functions subfolder and add pubspec.yaml with following contents:

name: myproject_functions
description: My project functions
version: 0.0.1

environment:
  sdk: '>=1.20.1 <2.0.0'

dependencies:
  # Firebase Functions bindings
  firebase_functions_interop: ^0.0.1 
  # Node bindings required to compile a nice-looking JS file for Node.
  # Also provides access to globals like `require` and `exports`.
  node_interop: ^0.0.1 

transformers:
  - $dart2js
  - node_interop # This transformer must go after $dart2js

Then run pub get to install dependencies.

3. Write a Web function #

Create bin/index.dart and type in something like this:

import 'package:firebase_functions_interop/firebase_functions_interop.dart';

void main() {
  FirebaseFunctions functions = new FirebaseFunctions();
  var httpsFunc = functions.https.onRequest((request, response) {
    response.send('Hello from Firebase Functions Dart Interop!');
  });

  exports.setProperty('helloWorld', httpsFunc);
}

Copy-pasting also works.

4. Build your function #

Building functions is as simple as running pub build. Note that Pub by default assumes a "web" project and only builds web folder so we need to explicitely tell it about bin:

$ pub build bin

5. Copy and deploy #

The result of pub build is located in build/bin/index.dart.js. Replace default index.js with the built version:

$ cp build/bin/index.dart.js index.js

Deploy using Firebase CLI:

$ firebase deploy --only functions

6. Test it #

Navigate to the new function's URL printed out by the deploy command. You should see "Hello from Firebase Functions Dart Interop!" on the screen.

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Changelog #

0.0.1 #

  • Initial version

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  firebase_functions_interop: ^0.0.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:firebase_functions_interop/firebase_functions_interop.dart';
  
Version Uploaded Documentation Archive
1.0.0+1 Dec 6, 2018 Go to the documentation of firebase_functions_interop 1.0.0+1 Download firebase_functions_interop 1.0.0+1 archive
1.0.0 Dec 6, 2018 Go to the documentation of firebase_functions_interop 1.0.0 Download firebase_functions_interop 1.0.0 archive
0.0.4+1 Oct 9, 2017 Go to the documentation of firebase_functions_interop 0.0.4+1 Download firebase_functions_interop 0.0.4+1 archive
0.0.4 Oct 8, 2017 Go to the documentation of firebase_functions_interop 0.0.4 Download firebase_functions_interop 0.0.4 archive
0.0.3 Sep 30, 2017 Go to the documentation of firebase_functions_interop 0.0.3 Download firebase_functions_interop 0.0.3 archive
0.0.2 Aug 1, 2017 Go to the documentation of firebase_functions_interop 0.0.2 Download firebase_functions_interop 0.0.2 archive
0.0.1 Jun 18, 2017 Go to the documentation of firebase_functions_interop 0.0.1 Download firebase_functions_interop 0.0.1 archive
1.0.0-dev.11.0 Oct 22, 2018 Go to the documentation of firebase_functions_interop 1.0.0-dev.11.0 Download firebase_functions_interop 1.0.0-dev.11.0 archive
1.0.0-dev.10.0 Oct 5, 2018 Go to the documentation of firebase_functions_interop 1.0.0-dev.10.0 Download firebase_functions_interop 1.0.0-dev.10.0 archive
1.0.0-dev.9.0 Aug 22, 2018 Go to the documentation of firebase_functions_interop 1.0.0-dev.9.0 Download firebase_functions_interop 1.0.0-dev.9.0 archive

All 22 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
75
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
38
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <2.0.0