Update
Logging data Try-catch function
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:sfm_app/product/utils/app_logger_utils.dart';
|
||||
import 'package:sfm_app/product/utils/responsive_text_utils.dart';
|
||||
|
||||
import '../theme/app_theme_light.dart';
|
||||
@@ -169,3 +170,15 @@ extension TextStyleExtention on BuildContext {
|
||||
TextStyle get headlineLargeTextStyle =>
|
||||
Theme.of(this).textTheme.headlineLarge!;
|
||||
}
|
||||
|
||||
|
||||
extension FutureExtension<T> on Future<T> {
|
||||
Future<T> handleApiError() async {
|
||||
try {
|
||||
return await this;
|
||||
} catch (e) {
|
||||
AppLoggerUtils.error(e.toString());
|
||||
return Future.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user