Utils class
Central utility class providing convenient access to commonly used services and helpers.
Utils implements the singleton pattern and acts as a facade providing static access
to frequently used utility classes throughout the application. This eliminates the need
to import multiple classes and provides a unified access point.
Available utilities:
- commonFunction: Common utility functions and helpers
- commonValidation: Input validation utilities
- appConstants: Application-wide constants (colors, sizes, styles)
- commonWidgets: Reusable UI widgets
- appFontFamily: Font family definitions
Example:
// Access validation utilities
if (Utils.commonValidation.isValidEmail(email)) {
// Process email
}
// Use common widgets
Utils.commonWidgets.addVerticalSpace(0.02);
// Access app constants
final padding = Utils.appConstants.boxPadding;
This class reduces coupling and provides a convenient, centralized access pattern for commonly used utilities across the application.
Constructors
- Utils()
-
Factory constructor returning the singleton instance.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
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
- appConstants → RtAppConstants
-
Provides access to application constants.
no setter
- appFontFamily → RtAppFontFamily
-
Provides access to font family definitions.
no setter
- commonFunction → RtCommonFunction
-
Provides access to common utility functions.
no setter
- commonValidation → RtCommonValidation
-
Provides access to validation utilities.
no setter
- commonWidgets → RtCommonWidget
-
Provides access to common widget utilities.
no setter
- instance → Utils
-
Returns the singleton instance of Utils.
no setter