EditorImage class
Flutter EditorImage Class Documentation
The EditorImage class represents an image with multiple sources, including
bytes, file, network URL, and asset path. It provides flexibility for loading
images from various sources in a Flutter application.
Usage:
EditorImage image = EditorImage(
byteArray: imageBytes,
);
Properties:
-
byteArray(optional): A byte array representing the image data. -
file(optional): AFileobject representing the image file. -
networkUrl(optional): A URL string pointing to an image on the internet. -
assetPath(optional): A string representing the asset path of an image.
Methods:
-
hasBytes: Indicates whether thebyteArrayproperty is not null. -
hasNetworkUrl: Indicates whether thenetworkUrlproperty is not null. -
hasFile: Indicates whether thefileproperty is not null. -
hasAssetPath: Indicates whether theassetPathproperty is not null. -
safeByteArray: A future that retrieves the image data as aUint8Listfrom the appropriate source based on theEditorImageType. -
type: Returns the type of the image source, determined by the available properties.
Example Usage:
EditorImage image = EditorImage(
byteArray: imageBytes,
);
if (image.hasBytes) {
// Handle image loaded from bytes.
}
EditorImageType imageType = image.type;
switch (imageType) {
case EditorImageType.memory:
// Handle image loaded from memory.
break;
case EditorImageType.asset:
// Handle image loaded from assets.
break;
case EditorImageType.file:
// Handle image loaded from file.
break;
case EditorImageType.network:
// Handle image loaded from network.
break;
}
Please refer to the documentation of individual properties and methods for more details.
Constructors
- EditorImage({Uint8List? byteArray, File? file, String? networkUrl, String? assetPath})
-
Creates an instance of the
EditorImageclass with the specified properties.
Properties
- assetPath → String?
-
A string representing the asset path of an image.
final
- byteArray ↔ Uint8List?
-
A byte array representing the image data.
getter/setter pair
- file → File?
-
A
Fileobject representing the image file.final - hasAssetPath → bool
-
Indicates whether the
assetPathproperty is not null.no setter - hasBytes → bool
-
Indicates whether the
byteArrayproperty is not null.no setter - hasFile → bool
-
Indicates whether the
fileproperty is not null.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- hasNetworkUrl → bool
-
Indicates whether the
networkUrlproperty is not null.no setter - networkUrl → String?
-
A URL string pointing to an image on the internet.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- type → EditorImageType
-
Returns the type of the image source, determined by the available properties.
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
safeByteArray(
BuildContext context) → Future< Uint8List> -
A future that retrieves the image data as a
Uint8Listfrom the appropriate source based on theEditorImageType. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited