chitfund/docs/FLUTTER_ERROR_FIX.md

1.9 KiB

🐛 Flutter Property Error - Fixed

Issue

Error: NoSuchMethodError: method not found: 'totalAmount'
Location: Member Dashboard
Cause: Wrong property name used


Root Cause

The ChitGroup model has property totalValue, but the member dashboard was trying to access totalAmount.


The Fix

File: luckychit/lib/interfaces/member/member_dashboard.dart

Changed property name:

// Before - Wrong property name
final totalAmount = group.totalAmount ?? 0;

// After - Correct property name
final totalValue = group.totalValue ?? 0.0;

Also cleaned up currency formatting:

// Before - Inline formatting
final totalValue = '₹${totalAmount.toString().replaceAllMapped(...)}';

// After - Separate method (cleaner)
final totalValueFormatted = '₹${_formatCurrency(totalValue)}';

String _formatCurrency(double amount) {
  final amountStr = amount.toStringAsFixed(0);
  return amountStr.replaceAllMapped(
    RegExp(r'(\d{1,3})(?=(\d{3})+(?!\d))'),
    (Match m) => '${m[1]},'
  );
}

ChitGroup Model Properties

Correct property names:

  • totalValue (not totalAmount)
  • monthlyInstallment
  • durationMonths
  • maxMembers
  • status

Deploy

# 1. Commit changes
git add luckychit/lib/interfaces/member/member_dashboard.dart
git commit -m "Fix member dashboard property name error"
git push origin prodnew

# 2. Deploy to production
ssh luckychit@192.168.8.148
cd /home/luckychit/apps/chitfund
./scripts/deploy.sh frontend

# 3. Clear browser cache
# Ctrl + Shift + R (or test in incognito)

Summary

Problem: Used wrong property name totalAmount instead of totalValue
Solution: Changed to correct property name from ChitGroup model
Status: Fixed
Deploy: ./scripts/deploy.sh frontend


The member dashboard should now load without errors! 🎉