ImageController class
Controller class for managing image data and state. Uses ChangeNotifier to notify listeners of state changes.
- Mixed-in types
Constructors
- ImageController.new({String key = "image", int? maxSize})
-
Creates an ImageController with optional
key
andmaxSize
parameters.
Properties
- bytes → Uint8List?
-
Returns the bytes of the current image, if any.
no setter
- extension → String?
-
Returns the file extension of the image, if any.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasImage → bool
-
Returns true if there is an image loaded.
no setter
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- hasNoImage → bool
-
Returns true if there is no image loaded.
no setter
- multipartFile → MultipartFile?
-
Returns the multipart file representation of the image, if any.
no setter
- name → String?
-
Returns the name of the image file, if any.
no setter
- onDrag ↔ bool
-
Indicates if a drag operation is currently active.
getter/setter pair
- onError ↔ bool
-
WEB
Indicates if there was an error loading or processing the image.getter/setter pair - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → Size?
-
Returns the size of the image, if any.
no setter
-
stream
↔ StreamController<
bool> ? -
getter/setter pair
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
changeOnDragState(
bool state) → void -
Changes the drag state to
state
and notifies listeners if changed. -
changeOnErrorState(
bool state) → void -
Changes the error state to
state
and notifies listeners. -
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
fromAsset(
{required Map< String, String> ? headers, required String url}) → Future<void> -
Loads image data from an asset URL with optional HTTP
headers
. -
fromUint8List(
{required Uint8List bytes, required String name}) → Future< void> -
Creates image data from a Uint8List of bytes and a file
name
. -
fromUrl(
{required Map< String, String> ? headers, required String url}) → Future<void> -
Loads image data from a URL with optional HTTP
headers
. -
getOnloadingImage(
{required String path}) → Future< void> -
Loads an image from a given
path
asynchronously. Uses_useCase.getOnloadingImage
and updates internal state. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
pickImage(
) → Future< void> - Opens a file picker to select an image, then processes and stores it.
-
preview(
BuildContext context, {double? sigma, bool? barrierDismissible, Object? tag, Color? barrierColor, Widget? closeButton, BoxDecoration? decoration}) → void -
Shows a preview of the current image using
showImagePreview
. Allows customization of the preview dialog appearance. -
removeImage(
) → void - Removes the currently loaded image and resets error state.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
startLoading(
) → void - Starts the loading process and notifies listeners.
-
stopLoading(
) → void - Stops the loading process and notifies listeners.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateHeaders(
Map< String, String> headers) → void - Updates the HTTP headers used for image requests.
-
updateKey(
String key) → void - Updates the key used for image data.
-
updateMaxSize(
int maxSize) → void - Updates the maximum allowed size for the image.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited