How anurajx/delhiunderground works
1. This is a Flutter client app for Delhi NCR metro information. The repo is primarily a single cross-platform mobile/desktop/web application, with no separate backend service checked in. The architecture is centered around bundled transit data and in-app UI flows for route lookup, station details, maps, and schedules.
2. The application entry point is lib/main.dart. From there, the app likely wires the top-level navigation and shared app state into feature screens under lib/elements. The naming suggests a simple screen-driven architecture rather than a heavily layered domain system.
3. The main user-facing subsystems are:
- lib/elements/metro.dart for the metro network home/map experience
- lib/elements/route.dart for route planning
- lib/elements/search.dart for search-driven station discovery
- lib/elements/StationDir/stationSearch.dart and stopInfo.dart for station detail lookup
These form the primary navigation boundaries in the app.
4. Map rendering is isolated under lib/elements/MapDir. mapMetro.dart and svgMap.dart suggest a dedicated map subsystem that renders the network visually, likely using static SVG or vector assets rather than live GIS services. This boundary is important because map presentation is separate from route/schedule logic.
5. Route computation and route-related data access are separated under lib/elements/RouteDir/routeDataProvider.dart. That indicates a provider-style layer that feeds the route UI with route metadata and possibly calculated route options. The app likely keeps route logic distinct from station lookup and map display.
6. Service and data-access logic lives in lib/elements/ServicesDir, which is the most important non-UI boundary in the repo. Files such as scheduleService.dart, newScheduleService.dart, openingClosingFetcher.dart, stopInfoFetcher.dart, gatesFetcher.dart, and reportErrorService.dart show that the app centralizes access to schedules, station metadata, gates, operating hours, and error reporting behind service classes or fetchers.
7. ServicesDir also includes station and proximity helpers such as geolocatorService.dart, metroStationsList.dart, and miniMetroStationList.dart, plus data_Provider.dart and Station_element.dart. This suggests the app supports station list generation, possibly near-station lookup, and a common station model used across route, search, and station-detail flows.
8. The app’s core data is bundled locally in assets/ rather than pulled from a dedicated backend. Key data sets include:
- assets/Map/ for stations, gates, parking, shapes, timetable-related JSON, and map styling
- assets/TimeTable/ for multiple route/day-specific CSV schedules
- assets/routes.db and assets/newTimeTable.json for additional structured transit data
- assets/fonts/ and animation JSON files for UI polish
This means the app’s architecture depends heavily on offline/static asset loading.
9. The data flow is likely: UI screens in lib/elements/* call service/provider classes in ServicesDir and RouteDir, which in turn read bundled assets and possibly device location via geolocatorService.dart. The resulting station, route, and schedule data is then rendered in the metro map, search, and stop-info views. The main boundary is between presentation and asset-backed data services.
10. Platform support is standard Flutter scaffolding for Android, iOS, web, Linux, macOS, and Windows. The platform folders mostly contain generated runners and launch configuration, while app-specific native code is minimal (MainActivity.kt, AppDelegate.swift, platform manifests/plists). This indicates the architecture is overwhelmingly Dart-side, with native layers acting only as host shells.
11. The repo includes a small test surface (test/widget_test.dart) and standard Flutter tooling files (pubspec.yaml, Gradle/Xcode/CMake scaffolding). There is no evidence of a complex CI/CD or backend architecture in the repository itself; deployment appears focused on packaged app releases, especially Android APKs as described in the README.
12. For an architecture diagram, the key nodes are: platform shell, Flutter app entry, feature screens, service/provider layer, and local transit assets. The strongest structural distinction is that this is an offline-first, asset-driven metro information app with map, route, station-search, and timetable subsystems sharing a common service layer.
Main entry points: main.dart App entry · Map Map assets · stopInfo.dart Stop details · mapMetro.dart Metro map
Components 26
Platform shells
Flutter host layers for desktop and mobile
- Android shell · Android runner and native app host
android - iOS shell · iOS runner and native app host
ios - Desktop shells · Linux, macOS, and Windows runner shells
linux
Flutter app
Dart entry point and user-facing screens
- App entry · Bootstraps the app and top-level navigation
lib/main.dart - Metro home · Main metro network experience and landing flow
lib/elements/metro.dart - Route planner · Route lookup and route-result experience
lib/elements/route.dart - Station search · Search-driven station discovery
lib/elements/search.dart - Station search · Station directory search and lookup
lib/elements/StationDir/stationSearch.dart - Stop details · Detailed station or stop information view
lib/elements/StationDir/stopInfo.dart - Metro map · Visual metro network map presentation
lib/elements/MapDir/mapMetro.dart - SVG map · SVG/vector map rendering support
lib/elements/MapDir/svgMap.dart
Data services
Route, station, schedule, and location access
- Route data · Supplies route metadata and route computation inputs
lib/elements/RouteDir/routeDataProvider.dart - Schedules · Primary schedule access and timetable logic
lib/elements/ServicesDir/scheduleService.dart - New schedule · Alternative or updated schedule source
lib/elements/ServicesDir/newScheduleService.dart - Stop fetcher · Loads stop and station detail data
lib/elements/ServicesDir/stopInfoFetcher.dart - Gate data · Loads station gate information
lib/elements/ServicesDir/gatesFetcher.dart - Hours data · Loads opening and closing time information
lib/elements/ServicesDir/openingClosingFetcher.dart - Location · Device geolocation and proximity support
lib/elements/ServicesDir/geolocatorService.dart - Station lists · Metro station catalogs and helper lists
lib/elements/ServicesDir/metroStationsList.dart - Mini list · Compact station list variant
lib/elements/ServicesDir/miniMetroStationList.dart - Data provider · Shared data access and station model plumbing
lib/elements/ServicesDir/data_Provider.dart - Station model · Shared station element used across features
lib/elements/ServicesDir/Station_element.dart - Error reports · Error reporting and feedback path
lib/elements/ServicesDir/reportErrorService.dart
Bundled data
Offline transit data and UI assets
- Map assets · Station, gate, shape, and map-style datasets
assets/Map - Timetables · Route and day-specific CSV schedules
assets/TimeTable - Local data · SQLite, JSON, and CSV transit data bundled with the app
assets/routes.db
Connections 29
- App entry → Metro home: starts · App entry wires the primary metro experience
- App entry → Route planner: nav · Top-level navigation reaches route planning
- App entry → Station search: nav · Top-level navigation reaches station search
- App entry → Metro map: nav · Top-level navigation reaches the map view
- Metro home → Metro map: shows · Metro home opens the network map experience
- Metro home → Station search: finds · Metro home links into station lookup
- Route planner → Route data: uses · Route screen depends on route data/provider logic
- Route data → Schedules: reads · Route data is enriched by timetable access
- Route data → Data provider: shares · Route calculations reuse shared data plumbing
- Station search → Station search: delegates · Search flows into station directory lookup
- Station search → Stop details: opens · Station lookup drills into stop details
- Stop details → Stop fetcher: loads · Stop detail view fetches station metadata
- Stop details → Gate data: loads · Stop detail view shows gate information
- Stop details → Hours data: loads · Stop detail view shows operating hours
- Metro map → SVG map: renders · Map screen relies on vector map rendering
- Metro map → Map assets: reads · Map presentation is driven by bundled map assets
- Schedules → Timetables: reads · Schedules are loaded from bundled timetable files
- New schedule → Local data: reads · Alternative schedule source consumes bundled data
- Stop fetcher → Map assets: reads · Stop metadata is sourced from the map/data bundle
- Gate data → Map assets: reads · Gate data comes from bundled map datasets
- Hours data → Map assets: reads · Opening and closing times are read from local data
- Location → Station lists: uses · Location features rely on station catalogs
- Location → Mini list: uses · Nearby lookup may use compact station lists
- Data provider → Station model: exposes · Shared data provider centers on station model objects
- Data provider → Map assets: reads · Common data access sources map and station assets
- Error reports → Local data: reports · Error reporting is part of the offline app data flow
- Android shell → App entry: hosts · Android runner hosts the Flutter entry point
- iOS shell → App entry: hosts · iOS runner hosts the Flutter entry point
- Desktop shells → App entry: hosts · Desktop runners host the Flutter entry point