execute method

  1. @override
Future<String> execute({
  1. required String functionId,
  2. String? params,
  3. bool isAsync = true,
})
override

Implementation

@override
Future<String> execute({required String functionId, String? params, bool isAsync = true}) async {
  await initialize();
  logger.finest('execute($functionId)');
  try {
    Map<String, dynamic>? jsonParams;
    if (params != null) {
      logger.finest('params=($params)');
      jsonParams = jsonDecode(params);
    }
    final HttpsCallableResult result =
        await functions!.httpsCallable(functionId).call(jsonParams);
    return result.data.toString();
  } on FirebaseFunctionsException catch (error) {
    logger.severe(error.code);
    logger.severe(error.details);
    logger.severe(error.message);
    throw HycopException(message: error.message!, code: int.parse(error.code));
  }
}