Skip to content

Instantly share code, notes, and snippets.



Created May 29, 2020
What would you like to do?
typedef void func();
var jsonResponse;
class CallAPI{
static String url = '';
static void getData(func f) async{
var response = await http.get(url);
if (response.statusCode == 200) {
jsonResponse = convert.jsonDecode(response.body);
print("API SUCCESS!");
} else {
print('Request failed with status: ${response.statusCode}.');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment