ContentModel.fromMap constructor

ContentModel.fromMap(
  1. Map<String, dynamic> data
)

Implementation

factory ContentModel.fromMap(Map<String, dynamic> data) {
    List<Datum>? filter = (data['data'] as List<dynamic>?)
        ?.map((e) => Datum.fromMap(e as Map<String, dynamic>))
        .toList();
    List<Datum> filteredData = filter!
        .where(
          (element) =>
              element.poster != null && element.poster![0].filelist != null,
        )
        .toList();

    return ContentModel(
      totalcount: data['totalcount'] as int?,
      data: filteredData,
    );
  }