Error
A component for displaying error states and error messages.
Basic Usage
❌
Something went wrong
Please try again later.
dart
1
2
3
4
DError(
title: 'Something went wrong',
description: 'Please try again later.',
)
With Retry
❌
Failed to load data
An error occurred while fetching your data.
dart
1
2
3
4
5
DError(
title: 'Failed to load data',
description: 'An error occurred while fetching your data.',
onRetry: () => fetchData(),
)
Severity Levels
⚠️
Connection unstable
Your internet connection appears to be slow.
❌
Something went wrong
An unexpected error occurred.
🚨
Critical error
The application encountered a fatal error.
dart
1
2
3
DError(severity: DErrorSeverity.warning, title: 'Warning', description: '...')
DError(severity: DErrorSeverity.error, title: 'Error', description: '...')
DError(severity: DErrorSeverity.fatal, title: 'Fatal', description: '...')
With Error Code
❌
Request failed
The server returned an error response.
Error code: ERR_500
dart
1
2
3
4
5
6
DError(
title: 'Request failed',
description: 'The server returned an error response.',
errorCode: 'ERR_500',
onRetry: () => retry(),
)
Custom Icon
No connection
Please check your internet connection.
dart
1
2
3
4
5
6
DError(
iconComponent: DIcon(name: 'wifi-off', size: 48, className: 'text-red-500'),
title: 'No connection',
description: 'Please check your internet connection.',
onRetry: () => checkConnection(),
)
Preset: 404 Error
🔍
Page not found
The page you are looking for does not exist or has been moved.
Error code: 404
dart
1
2
3
4
5
6
DError404(
action: DButton(
label: 'Go Home',
onClick: () => navigateToHome(),
),
)
Preset: 500 Error
🚧
Server error
An unexpected error occurred. Please try again later.
Error code: 500
dart
1
2
3
DError500(
onRetry: () => reload(),
)
Preset: Network Error
📶
Network error
Unable to connect. Please check your internet connection and try again.
dart
1
2
3
DErrorNetwork(
onRetry: () => retryConnection(),
)