diff --git a/packages/neon/neon/lib/src/utils/exceptions.dart b/packages/neon/neon/lib/src/utils/exceptions.dart index 09084834..41732471 100644 --- a/packages/neon/neon/lib/src/utils/exceptions.dart +++ b/packages/neon/neon/lib/src/utils/exceptions.dart @@ -22,13 +22,13 @@ class NeonExceptionDetails { final bool isUnauthorized; } -/// Extensible [Exception] to be used for displaying custom errors in the UI +/// Extensible [Exception] to be used for displaying custom errors in the UI. @immutable abstract class NeonException implements Exception { /// Creates a NeonException const NeonException(); - /// Details that will be rendered by the UI + /// Details that will be rendered by the UI. NeonExceptionDetails get details; } diff --git a/packages/neon/neon/lib/src/widgets/cached_image.dart b/packages/neon/neon/lib/src/widgets/cached_image.dart index d979ef2d..4f393d73 100644 --- a/packages/neon/neon/lib/src/widgets/cached_image.dart +++ b/packages/neon/neon/lib/src/widgets/cached_image.dart @@ -180,7 +180,7 @@ class _NeonCachedImageState extends State { ), ); - Widget _buildError(final dynamic error) => + Widget _buildError(final Object? error) => widget.errorBuilder?.call(context, error) ?? NeonError( error, diff --git a/packages/neon/neon/lib/src/widgets/error.dart b/packages/neon/neon/lib/src/widgets/error.dart index 4adb2282..f0a9328d 100644 --- a/packages/neon/neon/lib/src/widgets/error.dart +++ b/packages/neon/neon/lib/src/widgets/error.dart @@ -28,7 +28,7 @@ class NeonError extends StatelessWidget { /// The error object. /// /// Can be of type [String] or [Exception], various subtypes of `Exception` are also handled separately. - final dynamic error; + final Object? error; /// A function that's called when the user decides to retry the action that lead to the error. final VoidCallback onRetry; @@ -47,7 +47,7 @@ class NeonError extends StatelessWidget { final Color? color; /// Shows a [SnackBar] popup for the [error]. - static void showSnackbar(final BuildContext context, final dynamic error) { + static void showSnackbar(final BuildContext context, final Object? error) { final details = getDetails(error); ScaffoldMessenger.of(context).showSnackBar( @@ -132,7 +132,7 @@ class NeonError extends StatelessWidget { /// Gets the details for a given [error]. @internal - static NeonExceptionDetails getDetails(final dynamic error) { + static NeonExceptionDetails getDetails(final Object? error) { switch (error) { case String(): return NeonExceptionDetails( diff --git a/packages/neon/neon/lib/src/widgets/list_view.dart b/packages/neon/neon/lib/src/widgets/list_view.dart index 64015e4d..28035cde 100644 --- a/packages/neon/neon/lib/src/widgets/list_view.dart +++ b/packages/neon/neon/lib/src/widgets/list_view.dart @@ -18,7 +18,7 @@ class NeonListView extends StatelessWidget { final Iterable? items; final bool isLoading; - final dynamic error; + final Object? error; final RefreshCallback onRefresh; final Widget Function(BuildContext, T data) builder; final String? scrollKey;