refa: report error (#1747)

* refa: report error

* remove some reports [skip ci]

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>

---------

Co-authored-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
My-Responsitories
2025-11-17 17:20:29 +08:00
committed by GitHub
parent a797467606
commit 377e430d74
12 changed files with 159 additions and 129 deletions

View File

@@ -1,19 +1,20 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:math';
import 'dart:math' show Random;
import 'package:PiliPlus/common/constants.dart';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:share_plus/share_plus.dart';
abstract class Utils {
static final Random random = Random();
static final random = Random();
static const channel = MethodChannel(Constants.appName);
@@ -157,4 +158,24 @@ abstract class Utils {
final i1 = fileExt ? uri.length : uri.lastIndexOf('.');
return uri.substring(i0, i1);
}
/// When calling this from a `catch` block consider annotating the method
/// containing the `catch` block with
/// `@pragma('vm:notify-debugger-on-exception')` to allow an attached debugger
/// to treat the exception as unhandled.
static void reportError(
Object exception, [
StackTrace? stack,
String? library = 'PiliPlus',
bool silent = false,
]) {
FlutterError.reportError(
FlutterErrorDetails(
exception: exception,
stack: stack,
library: library,
silent: silent,
),
);
}
}