toMap method
Converts the ThreadWebRequest instance into a Map<String, dynamic>
representation.
This method serializes the request's properties into a map for easier data transfer or conversion to formats like JSON.
The resulting map contains the following key-value pairs:
'id'
: The unique identifier of the request.'mode'
: The mode of the operation (fixed to'encode'
).'generateOnlyImageBounds'
: Alwaysnull
, as it is not used in this operation.'outputFormat'
: The output format of the image (e.g.,'png'
,'jpeg'
).'jpegChroma'
: The chroma subsampling mode for JPEG format (e.g.,'yuv444'
).'pngFilter'
: The PNG filter type used for compression.'jpegQuality'
: Anint
specifying the JPEG quality (0–100).'pngLevel'
: Anint
specifying the PNG compression level (0–9).'singleFrame'
: Abool
indicating whether to process a single frame only.'image'
: AMap<String, dynamic>
representation of the image, created using imageToMap.
Implementation
Map<String, dynamic> toMap() {
return {
'id': id,
'mode': mode,
'generateOnlyImageBounds': null,
'outputFormat': outputFormat.name,
'jpegChroma': jpegChroma.name,
'pngFilter': pngFilter.name,
'jpegQuality': jpegQuality,
'pngLevel': pngLevel,
'singleFrame': singleFrame,
'image': imageToMap(),
};
}