getAssets static method

Future<ClientResponse<List<Asset>>> getAssets()

Implementation

static Future<ClientResponse<List<Asset>>> getAssets() async {
  try {
    final response = await http.get(
          Uri.parse('$apiURL/payment-button/assets'),
          headers: getHeaders(null),
        ),
        data = jsonDecode(response.body);

    return ClientResponse.fromJson(
      data,
      result: (json) => Asset.listFrom(json),
    );
  } catch (error) {
    throw ClientError.fromError(
      error,
      code: ClientCode.getAssetsError,
      message: I18n.t.errors.getAssetsError,
    );
  }
}