NativeException.fromCode constructor

NativeException.fromCode({
  1. required String code,
  2. required PlatformException platformException,
  3. required StackTrace stackTrace,
})

Implementation

factory NativeException.fromCode({
  required String code,
  required PlatformException platformException,
  required StackTrace stackTrace,
}) {
  final type = NativeExceptionType.values.firstWhere(
    (type) => type.code == code,
    orElse: () => NativeExceptionType.unexpected,
  );
  return NativeException(
    type: type,
    platformException: platformException,
    stackTrace: stackTrace,
  );
}