imageToMap method
Converts the image property into a Map<String, dynamic>
representation.
The resulting map includes metadata and buffer data for the image:
'buffer'
: The raw bytes of the image.'width'
: The width of the image in pixels.'height'
: The height of the image in pixels.'textData'
: A map of any text-based metadata associated with the image.'frameDuration'
: The duration of the frame in milliseconds (if applicable).'frameIndex'
: The index of the frame (for multi-frame images).'loopCount'
: The number of times the animation loops (for animated images).'numChannels'
: The number of color channels in the image (e.g., 3 for RGB).'rowStride'
: The number of bytes in a single row of the image.'frameType'
: The type of frame (e.g.,'sequence'
,'key'
).'format'
: The format of the image (e.g.,'uint8'
,'float32'
).
Implementation
Map<String, dynamic> imageToMap() {
return {
'buffer': image.buffer,
'width': image.width,
'height': image.height,
'textData': image.textData,
'frameDuration': image.frameDuration,
'frameIndex': image.frameIndex,
'loopCount': image.loopCount,
'numChannels': image.numChannels,
'rowStride': image.rowStride,
'frameType': image.frameType.name,
'format': image.format.name,
};
}