Skip to content
Build guide

Pillar B — Build guides

Published 2026-06-09 · Updated 2026-06-19 · By Avinash Chandan, Founder, Navamsha

Build a Daily Panchang Widget in Flutter with Navamsha

A Flutter Panchang widget shows today's tithi, nakshatra, yoga, and sunrise for the user's location. Navamsha's GET /api/v1/panchang/daily returns all fields in one lightweight call — ideal for home-screen widgets refreshed once per day.

Fetch pattern

Dart — daily Panchang via your backend

Future<Map<String, dynamic>> fetchDailyPanchang({
  required String date,
  required double lat,
  required double lng,
}) async {
  final uri = Uri.parse('https://your-backend.example/v1/panchang/daily')
      .replace(queryParameters: {
    'date': date,
    'latitude': lat.toString(),
    'longitude': lng.toString(),
  });
  final res = await http.get(uri);
  if (res.statusCode != 200) throw Exception('Panchang failed');
  return jsonDecode(res.body) as Map<String, dynamic>;
}

Caching strategy

  • Cache by date + rounded lat/lng — one API call per user per day is enough for widgets.
  • Use geolocator for coordinates; fall back to a saved city if permission denied.
  • Refresh after local midnight or on pull-to-refresh.

FAQ

Can Flutter call Navamsha directly?

Only if you embed a proxy — never ship raw API keys in mobile binaries. Use your backend or Firebase Cloud Function as the key holder.

Which endpoint for home widgets?

GET /api/v1/panchang/daily — see /apis/panchang and /panchang-api for parameter details.