import 'named_api_resource.dart'; mixin ResourceBase { /// The raw JSON data from the API Map get rawData; /// Gets a resource from a NamedAPIResource Future getNamedResource(NamedAPIResource resource, [T Function(dynamic value)? mapper]) async { final mapFn = mapper ?? (dynamic value) => value as T; return mapFn(await resource.get()); } @override String toString() { return '$runtimeType${toJson()}'; } Map toJson() => rawData; }