Technical Documentation: Dashboard Screen
Architecture


This screen is built around the fl_chart library, consuming aggregated data from the backend analytics engine. It focuses on batch-processed data rather than low-latency raw streams.
Technical Details
- File Path: lib/screens/new_dashboard_screen.dart
- Data Endpoints:
- GET /api/dashboard/analytics/battery: Timeseries data for battery levels.
- GET /api/dashboard/analytics/notifications: Aggregated counts of alert types.
- GET /api/dashboard/mission/summary: Statistical overview of navigation missions.
Implementation Details


- Charts:
- Line Chart: Used for Battery history, using FlSpot mapping for coordinate points.
- Pie/Donut Chart: Used for Notification distribution, showing percentage breakdowns.
- Caching: Analytics data is cached locally for 5 minutes after the first fetch to minimize backend load on repeated screen visits.
- Transformers: Includes generic data transformers to map raw JSON results from the /analytics endpoint into LineChartData and PieChartData objects.
Responsiveness
The dashboard uses a LayoutBuilder to switch from a 3-column "Wide Grid" (Desktop) to a 1-column "Long Scroll" (Mobile), ensuring charts remain readable at any scale.