encodedParams property

Future<String> get encodedParams

Implementation

Future<String> get encodedParams async {
  var urlObj = {};
  urlObj['API_KEY'] = apiKey;
  urlObj['host'] = _host;
  urlObj['sdk'] = 'magic-sdk-flutter';
  urlObj['locale'] = locale.toString().split('.').last;
  var packageInfo = await PackageInfo.fromPlatform();
  urlObj['bundleId'] = packageInfo.packageName;

  if (_customUrl != null) {
    urlObj['ETH_NETWORK'] = _customUrl;
  }

  if (_ethNetwork != null) {
    urlObj['ETH_NETWORK'] = _ethNetwork;
  }

  if (_ext != null) {
    urlObj['ext'] = _ext;
  }

  // Encode params to base64
  var jsonStr = json.encode(urlObj);
  var bytes = utf8.encode(jsonStr);
  return base64.encode(bytes);
}