diff --git a/example/lib/main.dart b/example/lib/main.dart index a594afe..420dd77 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -127,13 +127,13 @@ class _CropSampleState extends State { switch (result) { case CropSuccess(:final croppedImage): _croppedData = croppedImage; - case CropFailure(:final error): + case CropFailure(:final cause): showDialog( context: context, builder: (context) => AlertDialog( title: Text('Error'), content: - Text('Failed to crop image: ${error}'), + Text('Failed to crop image: ${cause}'), actions: [ TextButton( onPressed: () => diff --git a/lib/src/logic/cropper/errors.dart b/lib/src/logic/cropper/errors.dart index f1f6cea..d104d57 100644 --- a/lib/src/logic/cropper/errors.dart +++ b/lib/src/logic/cropper/errors.dart @@ -1,6 +1,6 @@ import 'dart:ui'; -class NegativeSizeError extends Error { +class NegativeSizeError implements Exception { final Offset topLeft; final Offset bottomRight; @@ -10,7 +10,7 @@ class NegativeSizeError extends Error { }); } -class InvalidRectError extends Error { +class InvalidRectError implements Exception { final Offset topLeft; final Offset bottomRight; diff --git a/lib/src/logic/cropper/image_cropper.dart b/lib/src/logic/cropper/image_cropper.dart index 1b5ec0b..4898df8 100644 --- a/lib/src/logic/cropper/image_cropper.dart +++ b/lib/src/logic/cropper/image_cropper.dart @@ -51,7 +51,7 @@ abstract class ImageCropper { CircleCropper get circleCropper; } -typedef RectValidator = Error? Function( +typedef RectValidator = Exception? Function( T original, Offset topLeft, Offset bottomRight); typedef RectCropper = Uint8List Function( T original, { diff --git a/lib/src/logic/parser/errors.dart b/lib/src/logic/parser/errors.dart index 3196a8d..a008781 100644 --- a/lib/src/logic/parser/errors.dart +++ b/lib/src/logic/parser/errors.dart @@ -1,6 +1,6 @@ import 'package:crop_your_image/src/logic/format_detector/format.dart'; -class InvalidInputFormatError extends Error { +class InvalidInputFormatError implements Exception { final ImageFormat? inputFormat; InvalidInputFormatError(this.inputFormat); diff --git a/lib/src/widget/crop_result.dart b/lib/src/widget/crop_result.dart index fdab479..dd40896 100644 --- a/lib/src/widget/crop_result.dart +++ b/lib/src/widget/crop_result.dart @@ -12,7 +12,7 @@ class CropSuccess extends CropResult { } class CropFailure extends CropResult { - const CropFailure(this.error, [this.stackTrace]); - final Object error; + const CropFailure(this.cause, [this.stackTrace]); + final Object cause; final StackTrace? stackTrace; -} \ No newline at end of file +}