fetchToken method
Implementation
Future<String> fetchToken() async {
String? token;
http.Response response;
try {
response = await http
.post(Uri.parse("https://adl.wisefly.in/token/generat_token"));
if (response.statusCode == 200) {
tm = TokenModel.fromJson(jsonDecode(response.body));
token = tm!.token;
return token;
} else {
return "";
}
} catch (e) {
throw e.toString();
}
}