QrGenerationOptions.fromJson constructor
Creates options from a JSON map
Implementation
factory QrGenerationOptions.fromJson(Map<String, dynamic> json) {
return QrGenerationOptions(
size: json['size'] as int? ?? 512,
errorCorrectionLevel: ErrorCorrectionLevel.fromString(
json['errorCorrectionLevel'] as String? ?? 'MEDIUM',
),
foregroundColor: Color(json['foregroundColor'] as int? ?? 0xFF000000),
backgroundColor: Color(json['backgroundColor'] as int? ?? 0xFFFFFFFF),
margin: json['margin'] as int? ?? 20,
logoData: json['logoData'] as Uint8List?,
logoSizeRatio: json['logoSizeRatio'] as double? ?? 0.2,
roundedCorners: json['roundedCorners'] as bool? ?? false,
cornerRadius: json['cornerRadius'] as double? ?? 4.0,
gradientColors: (json['gradientColors'] as List?)
?.map((colorValue) => Color(colorValue as int))
.toList(),
gradientDirection: json['gradientDirection'] as double? ?? 0.0,
addBorder: json['addBorder'] as bool? ?? false,
borderWidth: json['borderWidth'] as int? ?? 2,
borderColor: Color(json['borderColor'] as int? ?? 0xFF000000),
);
}