listSymbols function

Future<bool> listSymbols({
  1. required String appId,
  2. required String token,
})

Implementation

Future<bool> listSymbols({
  required String appId,
  required String token,
}) async {
  final url = 'https://api.raygun.com/v3/applications/$appId/flutter-symbols';
  final request = http.MultipartRequest('GET', Uri.parse(url));
  request.headers.addAll({
    'Authorization': 'Bearer $token',
    'Content-Type': 'multipart/form-data',
  });
  final res = await request.send();
  if (res.statusCode == 200) {
    final string = await res.stream.bytesToString();
    final listItems = jsonDecode(string) as List<dynamic>;
    print('');
    print('List of symbols:');
    print('');
    for (final item in listItems) {
      print('Symbols File: ${item['name']}');
      print('Identifier: ${item['identifier']}');
      print('App Version: ${item['version']}');
      print('');
    }
    return true;
  } else {
    print('Error getting list. Response code: ${res.statusCode}');
    return false;
  }
}