part of 'metadata.dart'; class SpotubeFlattenedPaginationObject { final int limit; final int? nextOffset; final int total; final bool hasMore; final List items; SpotubeFlattenedPaginationObject({ required this.limit, required this.nextOffset, required this.total, required this.hasMore, required this.items, }); static SpotubeFlattenedPaginationObject from( SpotubePaginationResponseObject response, T Function(SpotubePaginationResponseObjectItem item) parse, ) { return SpotubeFlattenedPaginationObject( limit: response.limit, nextOffset: response.nextOffset, total: response.total, hasMore: response.hasMore, items: response.items.map((item) => parse(item)).toList(growable: false), ); } SpotubeFlattenedPaginationObject copyWith({ int? limit, int? nextOffset, int? total, bool? hasMore, List? items, }) { return SpotubeFlattenedPaginationObject( limit: limit ?? this.limit, nextOffset: nextOffset ?? this.nextOffset, total: total ?? this.total, hasMore: hasMore ?? this.hasMore, items: items ?? this.items, ); } } extension SpotubePaginationResponseObjectExtension on SpotubePaginationResponseObject { SpotubeFlattenedPaginationObject flatten() { return SpotubeFlattenedPaginationObject.from( this, (item) => item.field0 as T, ); } }