fromNetwork static method
Creates the auth credentials with the JSON obtained from the given url
Implementation
static Future<DialogAuthCredentials> fromNetwork(String url) async {
final uri = Uri.parse(url);
final response = await http.get(
uri,
headers: {
"Accept": "application/json",
},
);
if (!HttpUtil.isValidStatusCode(response.statusCode)) {
throw Exception('Could not get response from $url');
}
final Map<String, dynamic> json = jsonDecode(response.body);
return DialogAuthCredentials.fromJson(json);
}