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 README.md.

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.

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.

Libraries

cloud_functions