BMFPolyline.fromMap constructor Null safety

BMFPolyline.fromMap(
  1. Map map
)

map => BMFPolyline

Implementation

BMFPolyline.fromMap(Map map)
    : assert(map['coordinates'] != null),
      assert(map['indexs'] != null),
      assert(map['colors'] != null),
      super.fromMap(map) {
  if (map['coordinates'] != null) {
    coordinates = <BMFCoordinate>[];
    map['coordinates'].forEach((v) {
      coordinates.add(BMFCoordinate.fromMap(v as Map));
    });
  }

  if (map['indexs'] != null) {
    indexs = <int>[];
    map['indexs'].forEach((v) {
      indexs.add(v as int);
    });
  }

  if (map['colors'] != null) {
    colors = <Color>[];
    map['colors'].forEach((v) {
      colors!.add(ColorUtil.hexToColor(v as String));
    });
  }

  if (map['textures'] != null) {
    textures = <String>[];
    map['textures'].forEach((v) {
      textures!.add(v as String);
    });
  }

  width = map['width'] as int?;
  dottedLine = map['dottedLine'] as bool?;
  lineDashType = BMFLineDashType.values[map['lineDashType'] as int];
  lineCapType = BMFLineCapType.values[map['lineCapType'] as int];
  lineJoinType = BMFLineJoinType.values[map['lineJoinType'] as int];
  lineDirectionCross180 = BMFLineDirectionCross180Type
      .values[map['lineDirectionCross180'] as int];
  isThined = map['isThined'] as bool?;
  clickable = map['clickable'] as bool?;
  isKeepScale = map['isKeepScale'] as bool?;
  isFocus = map['isFocus'] as bool?;
}