fetchPubspecContent method

  1. @override
Future<String> fetchPubspecContent(
  1. Uri uri
)
override

Fetches the content of a file.yaml file given its URI.

Implementation

@override
Future<String> fetchPubspecContent(Uri uri) async {
  try {
    final response = await dio.getUri(uri);
    if (response.statusCode == 200) {
      return response.data.toString();
    } else {
      throw Exception(
          'Failed to fetch pubspec content: ${response.statusCode} ${response.statusMessage}');
    }
  } on DioException catch (e) {
    print('Error fetching pubspec content: ${e.message}');
    rethrow;
  }
}