signOut method
Implementation
Future<AuthResponse<T>> signOut({
Object? args,
String? id,
bool notifiable = true,
}) async {
try {
emit(
AuthResponse.loading(AuthType.logout),
args: args,
id: id,
notifiable: notifiable,
);
final response = await delegate.signOut();
if (!response.isSuccessful) {
return _failure(
response.error,
type: AuthType.logout,
args: args,
id: id,
notifiable: notifiable,
);
}
_backupEmitEnabled = false;
try {
await _clearLocal();
} finally {
_backupEmitEnabled = true;
}
return emit(
AuthResponse.unauthenticated(
msg: msg.signOut.done,
type: AuthType.logout,
),
args: args,
id: id,
notifiable: notifiable,
);
} catch (error) {
_backupEmitEnabled = true;
return _failure(
msg.signOut.failure ?? error.toString(),
type: AuthType.logout,
args: args,
id: id,
notifiable: notifiable,
);
}
}