getRequest function
Implementation
Future getRequest(BuildContext context, String url, {bool? futureBuilder, Map? headers}) {
Map customHeaders = headers != null ? headers : {};
return dio
.get(url,
options: Options(headers: {
...customHeaders as Map<String, dynamic>
}))
.catchError((err) {
if (!futureBuilder!) showSnackBar(context, "Sorry an error occurred");
print(err);
});
}