updateAsync method
Cập nhật giá trị từ Future (bất đồng bộ)
Implementation
Future<void> updateAsync(Future<T> Function() futureCallback) async {
try {
final result = await futureCallback(); // Gọi và chờ đợi callback
value = result; // Cập nhật giá trị sau khi hoàn thành
} catch (e) {
print("Error while updating state: $e"); // Handle error nếu có
}
}