mirror of
https://mirror.ghproxy.com/https://github.com/StarCitizenToolBox/app.git
synced 2024-12-23 20:33:42 +08:00
18 lines
460 B
Dart
18 lines
460 B
Dart
import 'package:fluent_ui/fluent_ui.dart';
|
|
import 'package:starcitizen_doctor/common/utils/base_utils.dart';
|
|
import 'package:starcitizen_doctor/common/utils/log.dart';
|
|
|
|
extension AsyncError on Future {
|
|
Future<T?> unwrap<T>({BuildContext? context}) async {
|
|
try {
|
|
return await this;
|
|
} catch (e) {
|
|
dPrint("unwrap error:$e");
|
|
if (context != null) {
|
|
showToast(context, "出现错误: $e");
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
}
|