authenticate static method
Authenticate user
Implementation
static Future<void> authenticate({dynamic data}) async {
if (data != null) {
assert(data is Map || data is Model, '''Data must be a Map or a Model
Example:
Auth.authenticate(data: {
"token": "abc123",
});
or
Auth.authenticate(data: user);''');
if (data is Model) {
data = data.toJson();
}
}
await NyStorage.saveJson(
key(),
data,
inBackpack: true,
);
}