MBImagesElement constructor

MBImagesElement({
  1. required Map<String, dynamic> dictionary,
})

Initializes an images element with the dictionary returned by the MBurger APIs.

  • Parameters:
    • dictionary: The dictionary returned by the APIs.

Implementation

factory MBImagesElement({required Map<String, dynamic> dictionary}) {
  List<MBImage> images = [];
  if (dictionary['value'] is List) {
    List<Map<String, dynamic>> value =
        List<Map<String, dynamic>>.from(dictionary['value'] as List);
    images = value.map((img) => MBImage(dictionary: img)).toList();
  }

  return MBImagesElement._(
    dictionary: dictionary,
    images: images,
  );
}