VAPConfigs.fromMap constructor

VAPConfigs.fromMap(
  1. Map<String, dynamic> json
)

Creates a VAPConfigs instance from a map of native data.

This factory constructor is used internally to parse configuration data received from the native VAP player. The map should contain all required fields with appropriate types.

Parameters:

  • json: Map containing configuration data from native code

Throws TypeError if required fields are missing or have wrong types.

Implementation

factory VAPConfigs.fromMap(Map<String, dynamic> json) {
  return VAPConfigs(
    width: json['width'] as int,
    height: json['height'] as int,
    fps: json['fps'] as int,
    totalFrames: json['totalFrames'] as int,
    videoHeight: json['videoHeight'] as int,
    videoWidth: json['videoWidth'] as int,
    isMix: json['isMix'] as bool,
    orien: VideoOrientation.fromValue(json['orien'] as int),
    alphaPointRect: Rect.fromLTRB(
      (json['alphaPointRect']["x"] as int).toDouble(),
      (json['alphaPointRect']["y"] as int).toDouble(),
      (json['alphaPointRect']["w"] as int).toDouble(),
      (json['alphaPointRect']["h"] as int).toDouble(),
    ),
    rgbPointRect: Rect.fromLTRB(
      (json['rgbPointRect']["x"] as int).toDouble(),
      (json['rgbPointRect']["y"] as int).toDouble(),
      (json['rgbPointRect']["w"] as int).toDouble(),
      (json['rgbPointRect']["h"] as int).toDouble(),
    ),
    version: json['version'] as int,
  );
}