Skip to content

[cloud_functions] Make HttpsCallable.call async #2706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,17 @@ class HttpsCallable {
/// automatically includes a Firebase Instance ID token to identify the app
/// instance. If a user is logged in with Firebase Auth, an auth ID token for
/// the user is also automatically included.
Future<HttpsCallableResult> call([dynamic parameters]) {
Future<HttpsCallableResult> call([dynamic parameters]) async {
try {
return CloudFunctionsPlatform.instance
.callCloudFunction(
appName: _cloudFunctions._app.name,
region: _cloudFunctions._region,
origin: _cloudFunctions._origin,
timeout: timeout,
functionName: _functionName,
parameters: parameters,
)
.then((response) => HttpsCallableResult._(response));
final response = await CloudFunctionsPlatform.instance.callCloudFunction(
appName: _cloudFunctions._app.name,
region: _cloudFunctions._region,
origin: _cloudFunctions._origin,
timeout: timeout,
functionName: _functionName,
parameters: parameters,
);
return HttpsCallableResult._(response);
} on PlatformException catch (e) {
if (e.code == 'functionsError') {
final String code = e.details['code'];
Expand Down