Debugging
Common Issues
Flutter
| Issue |
Solution |
Build runner conflicts |
dart run build_runner build --delete-conflicting-outputs |
| Provider not found |
Check Riverpod ref.watch is in a ConsumerWidget or ConsumerStatefulWidget |
| Supabase connection failed |
Verify .env variables match your Supabase project |
| Push notification not working |
Regenerate FCM token in settings or check fcm_token in profiles |
Web Apps (Next.js)
| Issue |
Solution |
| Prisma client not found |
npx prisma generate |
| API returns 500 |
Check pharmanet-admin/app/api/ logs in terminal |
| RLS policy error |
Grant proper Supabase service role key in .env.local |
| Chapa payment fails |
Check chapa_tx_ref is unique; verify webhook endpoint |
Logging
Flutter
// Debug prints — visible in terminal
debugPrint('Cart updated: ${items.length} items');
// Or use the logger if available in the codebase
Logger.log('Order placed: $orderId');
Web Apps
// Server-side logging (API routes)
console.log('Webhook received:', payload);
// Client-side
console.debug('Cart state:', cartItems);
Supabase Logs
- Dashboard → Logs for SQL query logs
- Dashboard → Auth → Logs for authentication events
- Database → Replication to verify Realtime is enabled