wrap<T> method
Wraps an async operation with loading state management.
Sets loading to true before the operation, and false after
(regardless of success or failure).
Implementation
Future<T> wrap<T>(CkAuthLoadingType type, Future<T> Function() action) async {
setLoading(type, true);
try {
return await action();
} finally {
setLoading(type, false);
}
}