NoInternetConfig class
NoInternetConfig is a configuration class designed specifically to manage
settings related to displaying the "No Internet" screen in an application.
This class provides customizable options for the message, button text,
and animation used when the user is offline. It also allows you to reset
the configuration to its default values and access the current settings
globally throughout the app.
Key Features:
- Customize the no-internet message, button text, and animation to match the app's design and user experience.
- Update these settings globally for consistent behavior across the app.
- Reset the configuration to default values, ensuring uniformity across sessions.
- Provides getters for easy access to the current configuration values at any time.
Usage Example:
// Instantiate with default values
NoInternetConfig config = NoInternetConfig();
// Customize the configuration
NoInternetConfig.instantiate(
NoInternetConfig(customMessage: 'No internet connection!', customMessageButton: 'Retry'),
);
// Access the current configuration
print(NoInternetConfig.message); // Outputs: 'No internet connection!'
Constructors
- NoInternetConfig({String? customMessage, String? customMessageButton, String? customAnim})
-
A factory constructor to create an instance of
NoInternetConfigwith optional custom values.factory
Properties
- customAnim → String?
-
The custom animation asset for the "No Internet" screen.
If not provided, the default animation will be used.
final
- customMessage → String?
-
The custom message to be displayed on the "No Internet" screen.
If not provided, the default message will be used.
final
- customMessageButton → String?
-
The custom text for the button on the "No Internet" screen.
If not provided, the default button text will be used.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
props
→ List<
Object?> -
The list of properties that will be used to determine whether
two instances are equal.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stringify → bool?
-
If set to
true, the toString method will be overridden to output this instance's props.no setterinherited
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
Static Properties
- anim → String
-
Getter for the animation asset on the "No Internet" screen.
Returns the currently configured animation asset, or the default animation asset if no custom value is set.
no setter
- message → String
-
Getter for the message displayed on the "No Internet" screen.
Returns the currently configured message, or the default message if no custom value is set.
no setter
- messageButton → String
-
Getter for the button text on the "No Internet" screen.
Returns the currently configured button text, or the default button text if no custom value is set.
no setter
Static Methods
-
instantiate(
NoInternetConfig customConfig) → Future< void> - This method allows setting custom values for the "No Internet" configuration globally. Any of the configuration values (message, button text, or animation) can be customized.
-
resetToDefaults(
) → void - Resets the configuration to its default values, which include the default message, button text, and animation asset.