diff --git a/rollbar_flutter/lib/src/hooks/platform_hook.dart b/rollbar_flutter/lib/src/hooks/platform_hook.dart index 09632eb..e8a7cac 100644 --- a/rollbar_flutter/lib/src/hooks/platform_hook.dart +++ b/rollbar_flutter/lib/src/hooks/platform_hook.dart @@ -6,6 +6,15 @@ class PlatformHook implements Hook { ErrorCallback? _originalOnError; PlatformDispatcher? _platformDispatcher; + static bool get isAvailable { + try { + (PlatformDispatcher.instance as dynamic)?.onError; + return true; + } on NoSuchMethodError { + return false; + } + } + bool onError(Object exception, StackTrace stackTrace) { Rollbar.error(exception, stackTrace); diff --git a/rollbar_flutter/lib/src/rollbar.dart b/rollbar_flutter/lib/src/rollbar.dart index 2ae2e45..ec56b78 100644 --- a/rollbar_flutter/lib/src/rollbar.dart +++ b/rollbar_flutter/lib/src/rollbar.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; import 'package:meta/meta.dart'; @@ -64,13 +63,4 @@ class RollbarFlutter { await appRunner(); } - - static bool get requiresCustomZone { - try { - (PlatformDispatcher.instance as dynamic)?.onError; - return false; - } on NoSuchMethodError { - return true; - } - } }