// Example: Shared API Response Model // Path: lib/shared/data/models/api_response.dart /// Generic wrapper for API responses class ApiResponse { final bool success; final T? data; final String? error; const ApiResponse({ required this.success, this.data, this.error, }); factory ApiResponse.fromJson( Map json, T Function(Map) fromJsonT, ) => ApiResponse( success: json['success'] as bool, data: json['data'] != null ? fromJsonT(json['data'] as Map) : null, error: json['error'] as String?, ); }