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): AFile
object 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 thebyteArray
property is not null. -
hasNetworkUrl
: Indicates whether thenetworkUrl
property is not null. -
hasFile
: Indicates whether thefile
property is not null. -
hasAssetPath
: Indicates whether theassetPath
property is not null. -
safeByteArray
: A future that retrieves the image data as aUint8List
from 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
EditorImage
class 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
File
object representing the image file.final - hasAssetPath → bool
-
Indicates whether the
assetPath
property is not null.no setter - hasBytes → bool
-
Indicates whether the
byteArray
property is not null.no setter - hasFile → bool
-
Indicates whether the
file
property is not null.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- hasNetworkUrl → bool
-
Indicates whether the
networkUrl
property 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
Uint8List
from the appropriate source based on theEditorImageType
. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited