executeAsync method
Implementation
Future<void> executeAsync(
Future<T> Function() operation, {
String? successMessage,
bool emitLoadingState = true,
}) async {
if (emitLoadingState) {
setLoading();
}
try {
final data = await operation();
setSuccess(data);
} catch (e) {
setError(e.toString());
}
}