cloud_functions 0.4.1+6

  • Readme
  • Changelog
  • Example
  • Installing
  • 95

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

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 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(

Calling the function:

dynamic resp = await;

Calling the function with parameters:

dynamic resp = await<String, dynamic>{

Getting Started #

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

Issues and feedback #

Please file Flutterfire specific issues, bugs, or feature requests in our issue tracker.

Plugin issues that are not specific to Flutterfire can be filed in the Flutter issue tracker.

To contribute a change to this plugin, please review our contribution guide, and send a pull request.

0.4.1+6 #

  • Fix analysis failures

0.4.1+5 #

  • Remove the deprecated author: field from pubspec.yaml
  • Migrate the plugin to the pubspec platforms manifest.
  • Bump the minimum Flutter version to 1.10.0.

0.4.1+4 #

  • Updated README instructions for contributing for consistency with other Flutterfire plugins.

0.4.1+3 #

  • Remove AndroidX warning.

0.4.1+2 #

  • Update Android package name.

0.4.1+1 #

  • Update documentation to reflect new repository location.
  • Update unit tests to call TestWidgetsFlutterBinding.ensureInitialized.

0.4.1 #

  • Support for cloud functions emulators.

0.4.0+3 #

  • Update google-services Android gradle plugin to 4.3.0 in documentation and examples.

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.


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:

  cloud_functions: ^0.4.1+6

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';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 21, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5

Maintenance suggestions

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.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
firebase_core ^0.4.0 0.4.3+2
flutter 0.0.0
meta ^1.1.6 1.1.8
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.11 1.14.12
firebase 7.2.0
firebase_core_platform_interface 1.0.2
firebase_core_web 0.1.1+2
flutter_web_plugins 0.0.0
http 0.12.0+4
http_parser 3.1.3
js 0.6.1+1
matcher 0.12.6
path 1.6.4
pedantic 1.9.0
quiver 2.1.2+1
sky_engine 0.0.99
source_span 1.6.0
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
test any