postShareAnalytic method

  1. @override
Future<String> postShareAnalytic(
  1. String analyticId,
  2. String? destinationEmail
)
override

Implementation

@override
Future<String> postShareAnalytic(
    String analyticId, String? destinationEmail) async {
  try {
    final String body = json.encode({
      'analytic_id': analyticId,
      'email': (destinationEmail != null) ? destinationEmail : ''
    });
    return await dio
        .post('${ApiEndpoints.SHARE}/1', data: body)
        .then((value) => value.data['vcode']);
  } on Exception catch (e) {
    throw HttpHelper.decodeErrorResponse(e,
        tag: TAG,
        logger: logger,
        defaultErrorMessage: "Failed to share this widget",
        meta: {
          'widget': analyticId,
          'email': (destinationEmail != null) ? destinationEmail : '',
          'method': 'postShareAnalytic'
        });
  }
}