This commit is contained in:
Juan Felipe Duarte
2023-06-06 17:15:49 -05:00
parent cca8c87e7c
commit ebcc95d06a
6 changed files with 128 additions and 28 deletions
+17
View File
@@ -0,0 +1,17 @@
import 'package:flutter/cupertino.dart';
import 'package:http/http.dart' as http;
class NetworkUtility {
static Future<String?> fetchUrl(Uri uri,
{Map<String, String>? headers}) async {
try {
final response = await http.get(uri, headers: headers);
if (response.statusCode == 200) {
return response.body;
}
} catch (e) {
debugPrint('error - ${e.toString()}');
}
return null;
}
}