loadFromLocation static method
Implementation
static Future<Token?> loadFromLocation(
Directory directory, String? filename) async {
var file = File(directory.path + (filename ?? 'userData.json'));
if (await file.exists()) {
var data = await file.readAsString();
try {
Map<String, dynamic> json = jsonDecode(data);
return Token.fromJson(json);
} on Exception {
return null;
}
}
return null;
}