I'm working on a flutter app and like to get data from a firebase cloud function. In the plugin cloud_functions 0.2.0 the method getHttpsCallable is introduced, but there is nowhere a description how to use it.
How can I access the data?
I tried the following, but it only prints "Instance of 'HttpsCallable'"
var result = CloudFunctions.instance.getHttpsCallable(
functionName: 'addUser',
parameters: {
"name": 'blabla',
"email": 'blabla'
}
);
print(result);
You can await the call method of httpsCallable.
The example app has the usage:
try {
final HttpsCallableResult result = await callable.call(
<String, dynamic>{
'message': 'hello world!',
'count': _responseCount,
},
);
print(result.data);
setState(() {
_response = result.data['repeat_message'];
_responseCount = result.data['repeat_count'];
});
} on CloudFunctionsException catch (e) {
print('caught firebase functions exception');
print(e.code);
print(e.message);
print(e.details);
} catch (e) {
print('caught generic exception');
print(e);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With