2

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?

0

1 Answer 1

7

In steps:

  1. Import the package:

    import 'package:cloud_functions/cloud_functions.dart';
    
  2. Create an instance:

    static final _functions = FirebaseFunctions.instance;
    
  3. 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:

Sign up to request clarification or add additional context in comments.

1 Comment

Must be instantiated from "FirebaseFunctions", no longer from "CloudFunctions"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.