21 lines
574 B
Dart
21 lines
574 B
Dart
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
import 'package:flutter/foundation.dart';
|
|
part 'api_list.freezed.dart';
|
|
part 'api_list.g.dart';
|
|
|
|
@Freezed(genericArgumentFactories: true)
|
|
abstract class ApiList<T> with _$ApiList<T> {
|
|
const factory ApiList({
|
|
@Default('') String cursor,
|
|
@Default(1) int page,
|
|
@Default(10) int size,
|
|
@Default(0) int total,
|
|
@Default([]) List<T> list,
|
|
}) = _ApiList<T>;
|
|
|
|
factory ApiList.fromJson(
|
|
Map<String, Object?> json,
|
|
T Function(Object?) fromJsonT,
|
|
) => _$ApiListFromJson(json, fromJsonT);
|
|
}
|