Map<String, dynamic> toJson(Object? Function(T)? toJsonT) { return { 'status': status, if (data != null) 'data': toJsonT != null ? toJsonT(data as T) : data, if (error != null) 'error': error, }; }