fromJson static method

FFillElement fromJson({
  1. required Map<String, dynamic> json,
})

Implementation

static FFillElement fromJson({required final Map<String, dynamic> json}) {
  final opacity = (json['opacity'] as num? ?? 1).toDouble();
  return FFillElement(
    color: json['color'] as String,
    stop: double.tryParse('${json['stop']}') ?? 0,
    opacity: opacity >= 0 && opacity <= 1 ? opacity : 1,
  );
}