تخطَّ إلى المحتوى

Flutter

التثبيت

flutter pub add heysada_athar

شرح الاستخدام أدناه بالإنجليزية، كما يظهر في سجل الحزمة، والشيفرة نفسها في كل لغة.

Error and crash reporting for Flutter apps over the Sentry protocol: the official Sentry Flutter SDK (MIT) pointed at your app’s DSN, with consent and the user from the shared core. Dart errors, native crashes (Android, NDK, iOS), ANRs and app hangs, release health and user feedback. It never interrupts the user.

Use it

dependencies:
  heysada_athar: ^0.1.0
Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Errors.init(const ErrorsOptions(
    dsn: 'https://<key>@<your ingest host>/ingest/<project>', // the panel: Apps → the app's key
    release: 'com.example.shop@4.2.0+420', // release health is counted per release
  ));
  runApp(const MyApp());
}
  • Errors: Errors.init starts the Sentry SDK, which reports FlutterError.onError and PlatformDispatcher.onError, and through its native SDKs Android crashes, NDK crashes and ANRs (anrTimeout, 5 s), and iOS crashes and app hangs (appHangTimeout, 2 s). The handlers you had before still run.
  • Report a caught error: Errors.captureException(e, stack); a message: Errors.captureMessage('…', level: ErrorLevel.warning). Both return the event’s id.
  • User feedback: Errors.sendFeedback('what happened', eventId: id).
  • Breadcrumbs and tags: add Errors.navigatorObserver to navigatorObservers for screens; Errors.addBreadcrumb('…') and Errors.setTag('plan', 'pro') add your own.
  • Your user: Errors.identify('your-user-id'), your own opaque id, never an email. Kept across launches; identify(null) goes back to the install’s random id. Crash-free users count by it.
  • Symbols: upload your build’s debug files (R8 mapping, --split-debug-info symbols, dSYMs) with the debug-files CLI and a server key from the panel, so stacks read as your code.
  • Not started until allowed: with requireConsent: true nothing is collected (the SDK isn’t even started) until Errors.grant(); Errors.revoke() stops it. Errors.setEnabled(false) turns it off whatever the consent. All three hold across launches.
  • Data collection off: no IP address or other default PII, no request bodies, no failed-request events, no screenshots or view hierarchy, no performance tracing.
  • Collected: the error, its stack, the app’s release and environment, the OS and device type, breadcrumbs, and your opaque user id.
  • It never throws into your app: if the SDK can’t start, nothing is collected.
  • Android: the app needs the INTERNET permission and minSdk 26 or later (sentry_flutter 10’s).
  • iOS: iOS 15 or later (sentry_flutter 10’s): set the app’s deployment target to 15.0.

Your privacy policy: template

This app sends error reports to help us fix crashes. A report contains the error, the app and OS version, the device type, and an anonymous id for you. It does not contain your name, email, location, IP address, or anything you typed. You can turn this off in Settings → [your switch].