I set up Cloud Functions in the local emulator. I wrote a few functions and tested them in the browser with the function emulator. Now I am trying to call these functions from my local Flutter app without deploying them. However, i cannot find a way to connect my Flutter App to the localhost API of the functions. Is there anyway to do that?
Asked
Active
Viewed 3,136 times
1 Answers
6
In steps:
Import the package:
import 'package:cloud_functions/cloud_functions.dart';
Create an instance:
static final _functions = CloudFunctions.instance;
Wire it up to the emulator:
final origin = Platform.isAndroid ? 'http://10.0.2.2:5001' : 'http://localhost:5001'; _functions.useFunctionsEmulator(origin: origin);
Also see:

Frank van Puffelen
- 565,676
- 79
- 828
- 807
-
3Must be instantiated from "FirebaseFunctions", no longer from "CloudFunctions" – edalvb Jun 18 '22 at 02:45