class DashboardMonthlyExpenseResponse { final bool success; final String message; final List data; final dynamic errors; final int statusCode; final String timestamp; DashboardMonthlyExpenseResponse({ required this.success, required this.message, required this.data, this.errors, required this.statusCode, required this.timestamp, }); factory DashboardMonthlyExpenseResponse.fromJson(Map json) { return DashboardMonthlyExpenseResponse( success: json['success'] ?? false, message: json['message'] ?? '', data: (json['data'] as List?) ?.map((e) => MonthlyExpenseData.fromJson(e)) .toList() ?? [], errors: json['errors'], statusCode: json['statusCode'] ?? 0, timestamp: json['timestamp'] ?? '', ); } Map toJson() => { 'success': success, 'message': message, 'data': data.map((e) => e.toJson()).toList(), 'errors': errors, 'statusCode': statusCode, 'timestamp': timestamp, }; } class MonthlyExpenseData { final String monthName; final int year; final double total; final int count; MonthlyExpenseData({ required this.monthName, required this.year, required this.total, required this.count, }); factory MonthlyExpenseData.fromJson(Map json) { return MonthlyExpenseData( monthName: json['monthName'] ?? '', year: json['year'] ?? 0, total: (json['total'] ?? 0).toDouble(), count: json['count'] ?? 0, ); } Map toJson() => { 'monthName': monthName, 'year': year, 'total': total, 'count': count, }; }