getFirebaseConfig method

Future<String> getFirebaseConfig()

Implementation

Future<String> getFirebaseConfig() async {
  final url = Uri.parse('${_wepinBaseUrl}user/firebase-config');
  final response = await http.get(url, headers: headers);

  if (response.statusCode >= 200 && response.statusCode < 300) {
    final decodeString = utf8.decode(base64.decode(response.body));
    final jsonObject = jsonDecode(decodeString);
    final key = jsonObject['apiKey'];
    return key;
  } else {
    throw WepinError(WepinErrorCode.apiRequestError, 'code: ${response.statusCode} , body: ${response.body}');
  }
}