zubairehman/Flogs

Change type of 'exception' parameter to dynamic

petro-i opened this issue · 3 comments

In dart/flutter environment unhandled 'exceptions' may be inherited of two different base classes Error and Exception. In case we call FLog.error(...) method in a unhandled error/exception callback where both 'Error' and 'Exception' can arrive, then in case Error comes, call of Flog.error(..) trows error by itself since Error and Exception are incompatible types.

Please change type of 'exception:' parameter to dynamic as it is done in variety of Crashlitics tools may be used with Flutter.

Hi @totalerex
Thanks for pointing out the issue, I will make sure to update the type and release a new version soon :)

+1! @totalerex

eg for DART

runZoned<Future<void>>(...},
onError: (dynamic _error, StackTrace _stackTrace) {} 

and eg for FLUTTER

FlutterError.onError = (FlutterErrorDetails details) {
FLog.logThis(text: "Flutter Error", type: LogLevel.ERROR, exception: details.exception, stacktrace: details.stack);
};

>>Unhandled Exception: type '_TypeError' is not a subtype of type 'Exception'

Thanks @zubairehman

Hi,
A new version (1.3.0-alpha-01) of the f_logs package to the Dart package site (pub.dev).

For details, go to https://pub.dev/packages/f_logs/versions/1.3.0-alpha-01