ApiSnackBarConfig class

Full customization for the success and error snackbars shown by the package.

ApiSnackBarConfig(
  successTitle: 'Done!',
  successMessageKey: 'message',   // reads response body["message"]
  errorTitle: 'Oops',
  successBackgroundColor: Colors.green,
  errorBackgroundColor: Colors.red,
  textColor: Colors.white,
  duration: Duration(seconds: 4),
)

Constructors

ApiSnackBarConfig({bool showOnSuccess = false, String? successTitle = 'Success', String? successMessageOverride, String? successMessageKey = 'message', bool showOnError = false, String? errorTitle = 'Error', String? errorMessageOverride, String? errorMessageKey = 'message', Color? backgroundColor, Color? successBackgroundColor, Color? errorBackgroundColor, Color? textColor, SnackPosition? position, Duration duration = const Duration(seconds: 3), double borderRadius = 12, EdgeInsets? margin})
Creates an ApiSnackBarConfig with the provided customizations.
const

Properties

backgroundColor Color?
Background color for both snackbars (fallback when the specific success/error color is not set).
final
borderRadius double
Corner radius of the snackbar. Defaults to 12.
final
duration Duration
How long the snackbar stays visible. Defaults to 3 seconds.
final
errorBackgroundColor Color?
Background color for the error snackbar. Overrides backgroundColor.
final
errorMessageKey String?
Key used to read the error message from the response body Map. Defaults to "message".
final
errorMessageOverride String?
Fixed message for the error snackbar. When null, ApiResponse.errorMessage is used.
final
errorTitle String?
Title of the error snackbar. Defaults to "Error".
final
hashCode int
The hash code for this object.
no setterinherited
margin EdgeInsets?
Outer margin of the snackbar. Defaults to EdgeInsets.all(12).
final
position → SnackPosition?
Snackbar position (SnackPosition.TOP or SnackPosition.BOTTOM). Defaults to SnackPosition.BOTTOM.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showOnError bool
Whether to show a snackbar on a failed response.
final
showOnSuccess bool
Whether to show a snackbar on a successful response.
final
successBackgroundColor Color?
Background color for the success snackbar. Overrides backgroundColor.
final
successMessageKey String?
Key used to read the success message from the response body Map. Defaults to "message".
final
successMessageOverride String?
Fixed message for the success snackbar. When null, the value at successMessageKey is read from the response body.
final
successTitle String?
Title of the success snackbar. Defaults to "Success".
final
textColor Color?
Text color for both snackbars.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited