cloud_functions 0.4.0+2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 92

Cloud Functions Plugin for Flutter #

A Flutter plugin to use the Cloud Functions for Firebase API

pub package

For Flutter plugins for other Firebase products, see FlutterFire.md.

Note: This plugin is still under development, and some APIs might not be available yet. Feedback and Pull Requests are most welcome!

Setup #

To use this plugin:

  1. Using the Firebase Console, add an Android app to your project: Follow the assistant, download the generated google-services.json file and place it inside android/app. Next, modify the android/build.gradle file and the android/app/build.gradle file to add the Google services plugin as described by the Firebase assistant. Ensure that your android/build.gradle file contains the maven.google.com as described here.
  2. Using the Firebase Console, add an iOS app to your project: Follow the assistant, download the generated GoogleService-Info.plist file, open ios/Runner.xcworkspace with Xcode, and within Xcode place the file inside ios/Runner. Don't follow the steps named "Add Firebase SDK" and "Add initialization code" in the Firebase assistant.
  3. Add cloud_functions as a dependency in your pubspec.yaml file.

Usage #

import 'package:cloud_functions/cloud_functions.dart';

Getting an instance of the callable function:

final HttpsCallable callable = CloudFunctions.instance.getHttpsCallable(
    functionName: 'YOUR_CALLABLE_FUNCTION_NAME',
);

Calling the function:

dynamic resp = await callable.call();

Calling the function with parameters:

dynamic resp = await callable.call(<String, dynamic>{
    'YOUR_PARAMETER_NAME': 'YOUR_PARAMETER_VALUE',
});

Getting Started #

See the example directory for a complete sample app using Cloud Functions for Firebase.

0.4.0+2 #

  • Automatically use version from pubspec.yaml when reporting usage to Firebase.

0.4.0+1 #

  • Remove reference to unused header file.

0.4.0 #

  • Removed unused parameters param from getHttpsCallable.

0.3.0+1 #

  • Update iOS dependencies to latest.

0.3.0 #

  • Update Android dependencies to latest.

0.2.0+1 #

  • Removed flaky timeout test.

0.2.0 #

  • Breaking change. Updated Dart API to replace call with getHttpsCallable.
  • Added support for timeouts.
  • Additional integration testing.

0.1.2+1 #

  • Added a driver test.

0.1.2 #

  • Specifying a version for Cloud Functions CocoaPod dependency to prevent build errors on iOS.
  • Fix on iOS when using a null region.
  • Upgrade the firebase_core dependency of the example app.

0.1.1+1 #

  • Log messages about automatic configuration of the default app are now less confusing.

0.1.1 #

  • Support for regions and multiple apps

0.1.0+1 #

  • Log a more detailed warning at build time about the previous AndroidX migration.

0.1.0 #

  • Breaking change. Migrate from the deprecated original Android Support Library to AndroidX. This shouldn't result in any functional changes, but it requires any Android apps using this plugin to also migrate if they're using the original support library.

0.0.5 #

  • Set iOS deployment target to 8.0 (minimum supported by both Firebase SDKs and Flutter), fixes compilation errors.
  • Fixes null pointer error when callable function fails with exception (iOS).

0.0.4+1 #

  • Bump Android dependencies to latest.

0.0.4 #

  • Fixed podspec to use static_framework

0.0.3 #

  • Added missing dependency on meta package.

0.0.2 #

  • Bump Android and Firebase dependency versions.

0.0.1 #

  • The Cloud Functions for Firebase client SDKs let you call functions directly from a Firebase app. This plugin exposes this ability to Flutter apps.

    Callable functions are similar to other HTTP functions, with these additional features:

    • With callables, Firebase Authentication and FCM tokens are automatically included in requests.
    • The functions.https.onCall trigger automatically deserializes the request body and validates auth tokens.

example/README.md

cloud_functions_example #

Demonstrates how to use the cloud_functions plugin.

Function #

This example assumes the existence of the following function:

import * as functions from 'firebase-functions';

export const repeat = functions.https.onCall((data, context) => {
  return {
      repeat_message: data.message,
      repeat_count: data.count + 1,
  }
});

This function accepts a message and count from the client and responds with the same message and an incremented count.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

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


dependencies:
  cloud_functions: ^0.4.0+2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:cloud_functions/cloud_functions.dart';
  
Version Uploaded Documentation Archive
0.4.0+2 Jun 19, 2019 Go to the documentation of cloud_functions 0.4.0+2 Download cloud_functions 0.4.0+2 archive
0.4.0+1 Jun 15, 2019 Go to the documentation of cloud_functions 0.4.0+1 Download cloud_functions 0.4.0+1 archive
0.4.0 May 30, 2019 Go to the documentation of cloud_functions 0.4.0 Download cloud_functions 0.4.0 archive
0.3.0+1 May 15, 2019 Go to the documentation of cloud_functions 0.3.0+1 Download cloud_functions 0.3.0+1 archive
0.3.0 May 7, 2019 Go to the documentation of cloud_functions 0.3.0 Download cloud_functions 0.3.0 archive
0.2.0+1 May 6, 2019 Go to the documentation of cloud_functions 0.2.0+1 Download cloud_functions 0.2.0+1 archive
0.2.0 May 1, 2019 Go to the documentation of cloud_functions 0.2.0 Download cloud_functions 0.2.0 archive
0.1.2+1 Mar 15, 2019 Go to the documentation of cloud_functions 0.1.2+1 Download cloud_functions 0.1.2+1 archive
0.1.2 Mar 8, 2019 Go to the documentation of cloud_functions 0.1.2 Download cloud_functions 0.1.2 archive
0.1.1+1 Feb 21, 2019 Go to the documentation of cloud_functions 0.1.1+1 Download cloud_functions 0.1.1+1 archive

All 18 versions...

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

We analyzed this package on Jun 19, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.2
  • pana: 0.12.18
  • Flutter: 1.5.4-hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (1 direct: meta).

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
firebase_core ^0.4.0 0.4.0+6
flutter 0.0.0
meta ^1.1.6 1.1.6 1.1.7
Transitive dependencies
collection 1.14.11
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_driver
flutter_test
test any