# anurajx/delhiunderground architecture

> Architecture diagram of the GitHub repository anurajx/delhiunderground, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anurajx/delhiunderground
- Repository: https://github.com/anurajx/delhiunderground

## Overview

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: [`lib/main.dart`](https://github.com/anurajx/delhiunderground/blob/main/lib/main.dart) (App entry), [`assets/Map`](https://github.com/anurajx/delhiunderground/tree/main/assets/Map) (Map assets), [`lib/elements/StationDir/stopInfo.dart`](https://github.com/anurajx/delhiunderground/blob/main/lib/elements/StationDir/stopInfo.dart) (Stop details), [`lib/elements/MapDir/mapMetro.dart`](https://github.com/anurajx/delhiunderground/blob/main/lib/elements/MapDir/mapMetro.dart) (Metro map)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_platform["Platform shells"]
  node_android_shell["Android shell<br/>host platform"]
  node_ios_shell["iOS shell<br/>host platform"]
  node_desktop_shells["Desktop shells<br/>host platform"]
end

subgraph group_app["Flutter app"]
  node_main["App entry<br/>Flutter entry<br/>[main.dart]"]
  node_metro["Metro home<br/>screen<br/>[metro.dart]"]
  node_route["Route planner<br/>screen<br/>[route.dart]"]
  node_search["Station search<br/>screen<br/>[search.dart]"]
  node_station_search["Station search<br/>screen<br/>[stationSearch.dart]"]
  node_stop_info["Stop details<br/>screen<br/>[stopInfo.dart]"]
  node_map_metro["Metro map<br/>map view<br/>[mapMetro.dart]"]
  node_svg_map["SVG map<br/>renderer<br/>[svgMap.dart]"]
end

subgraph group_logic["Data services"]
  node_route_provider["Route data<br/>provider"]
  node_schedule_service["Schedules"]
  node_new_schedule["New schedule"]
  node_stop_fetcher["Stop fetcher"]
  node_gate_fetcher["Gate data<br/>fetcher<br/>[gatesFetcher.dart]"]
  node_hours_fetcher["Hours data<br/>fetcher"]
  node_geo_service["Location"]
  node_station_lists["Station lists<br/>registry"]
  node_mini_lists["Mini list<br/>registry"]
  node_data_provider["Data provider<br/>[data_Provider.dart]"]
  node_station_model["Station model"]
  node_error_service["Error reports"]
end

subgraph group_assets["Bundled data"]
  node_map_data[("Map assets<br/>transit data")]
  node_timetables[("Timetables<br/>transit data")]
  node_static_data[("Local data<br/>bundle<br/>[routes.db]")]
end

node_main -->|"starts"| node_metro
node_main -->|"nav"| node_route
node_main -->|"nav"| node_search
node_main -->|"nav"| node_map_metro
node_metro -->|"shows"| node_map_metro
node_metro -->|"finds"| node_station_search
node_route -->|"uses"| node_route_provider
node_route_provider -->|"reads"| node_schedule_service
node_route_provider -->|"shares"| node_data_provider
node_search -->|"delegates"| node_station_search
node_station_search -->|"opens"| node_stop_info
node_stop_info -->|"loads"| node_stop_fetcher
node_stop_info -->|"loads"| node_gate_fetcher
node_stop_info -->|"loads"| node_hours_fetcher
node_map_metro -->|"renders"| node_svg_map
node_map_metro -->|"reads"| node_map_data
node_schedule_service -->|"reads"| node_timetables
node_new_schedule -->|"reads"| node_static_data
node_stop_fetcher -->|"reads"| node_map_data
node_gate_fetcher -->|"reads"| node_map_data
node_hours_fetcher -->|"reads"| node_map_data
node_geo_service -->|"uses"| node_station_lists
node_geo_service -->|"uses"| node_mini_lists
node_data_provider -->|"exposes"| node_station_model
node_data_provider -->|"reads"| node_map_data
node_error_service -.->|"reports"| node_static_data
node_android_shell -->|"hosts"| node_main
node_ios_shell -->|"hosts"| node_main
node_desktop_shells -->|"hosts"| node_main

click node_main "https://github.com/anurajx/delhiunderground/blob/main/lib/main.dart"
click node_metro "https://github.com/anurajx/delhiunderground/blob/main/lib/elements/metro.dart"
click node_route "https://github.com/anurajx/delhiunderground/blob/main/lib/elements/route.dart"
click node_search "https://github.com/anurajx/delhiunderground/blob/main/lib/elements/search.dart"
click node_station_search "https://github.com/anurajx/delhiunderground/blob/main/lib/elements/StationDir/stationSearch.dart"
click node_stop_info "https://github.com/anurajx/delhiunderground/blob/main/lib/elements/StationDir/stopInfo.dart"
click node_map_metro "https://github.com/anurajx/delhiunderground/blob/main/lib/elements/MapDir/mapMetro.dart"
click node_svg_map "https://github.com/anurajx/delhiunderground/blob/main/lib/elements/MapDir/svgMap.dart"
click node_route_provider "https://github.com/anurajx/delhiunderground/blob/main/lib/elements/RouteDir/routeDataProvider.dart"
click node_schedule_service "https://github.com/anurajx/delhiunderground/blob/main/lib/elements/ServicesDir/scheduleService.dart"
click node_new_schedule "https://github.com/anurajx/delhiunderground/blob/main/lib/elements/ServicesDir/newScheduleService.dart"
click node_stop_fetcher "https://github.com/anurajx/delhiunderground/blob/main/lib/elements/ServicesDir/stopInfoFetcher.dart"
click node_gate_fetcher "https://github.com/anurajx/delhiunderground/blob/main/lib/elements/ServicesDir/gatesFetcher.dart"
click node_hours_fetcher "https://github.com/anurajx/delhiunderground/blob/main/lib/elements/ServicesDir/openingClosingFetcher.dart"
click node_geo_service "https://github.com/anurajx/delhiunderground/blob/main/lib/elements/ServicesDir/geolocatorService.dart"
click node_station_lists "https://github.com/anurajx/delhiunderground/blob/main/lib/elements/ServicesDir/metroStationsList.dart"
click node_mini_lists "https://github.com/anurajx/delhiunderground/blob/main/lib/elements/ServicesDir/miniMetroStationList.dart"
click node_data_provider "https://github.com/anurajx/delhiunderground/blob/main/lib/elements/ServicesDir/data_Provider.dart"
click node_station_model "https://github.com/anurajx/delhiunderground/blob/main/lib/elements/ServicesDir/Station_element.dart"
click node_error_service "https://github.com/anurajx/delhiunderground/blob/main/lib/elements/ServicesDir/reportErrorService.dart"
click node_map_data "https://github.com/anurajx/delhiunderground/tree/main/assets/Map"
click node_timetables "https://github.com/anurajx/delhiunderground/tree/main/assets/TimeTable"
click node_static_data "https://github.com/anurajx/delhiunderground/blob/main/assets/routes.db"
click node_android_shell "https://github.com/anurajx/delhiunderground/tree/main/android"
click node_ios_shell "https://github.com/anurajx/delhiunderground/tree/main/ios"
click node_desktop_shells "https://github.com/anurajx/delhiunderground/tree/main/linux"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_android_shell,node_ios_shell,node_desktop_shells toneBlue
class node_main,node_metro,node_route,node_search,node_station_search,node_stop_info,node_map_metro,node_svg_map toneAmber
class node_route_provider,node_schedule_service,node_new_schedule,node_stop_fetcher,node_gate_fetcher,node_hours_fetcher,node_geo_service,node_station_lists,node_mini_lists,node_data_provider,node_station_model,node_error_service toneMint
class node_map_data,node_timetables,node_static_data toneRose
```

## Components

### Platform shells

Flutter host layers for desktop and mobile

- [Android shell](https://github.com/anurajx/delhiunderground/tree/main/android): host platform · Android runner and native app host · `android`
- [iOS shell](https://github.com/anurajx/delhiunderground/tree/main/ios): host platform · iOS runner and native app host · `ios`
- [Desktop shells](https://github.com/anurajx/delhiunderground/tree/main/linux): host platform · Linux, macOS, and Windows runner shells · `linux`

### Flutter app

Dart entry point and user-facing screens

- [App entry](https://github.com/anurajx/delhiunderground/blob/main/lib/main.dart): Flutter entry · Bootstraps the app and top-level navigation · `lib/main.dart`
- [Metro home](https://github.com/anurajx/delhiunderground/blob/main/lib/elements/metro.dart): screen · Main metro network experience and landing flow · `lib/elements/metro.dart`
- [Route planner](https://github.com/anurajx/delhiunderground/blob/main/lib/elements/route.dart): screen · Route lookup and route-result experience · `lib/elements/route.dart`
- [Station search](https://github.com/anurajx/delhiunderground/blob/main/lib/elements/search.dart): screen · Search-driven station discovery · `lib/elements/search.dart`
- [Station search](https://github.com/anurajx/delhiunderground/blob/main/lib/elements/StationDir/stationSearch.dart): screen · Station directory search and lookup · `lib/elements/StationDir/stationSearch.dart`
- [Stop details](https://github.com/anurajx/delhiunderground/blob/main/lib/elements/StationDir/stopInfo.dart): screen · Detailed station or stop information view · `lib/elements/StationDir/stopInfo.dart`
- [Metro map](https://github.com/anurajx/delhiunderground/blob/main/lib/elements/MapDir/mapMetro.dart): map view · Visual metro network map presentation · `lib/elements/MapDir/mapMetro.dart`
- [SVG map](https://github.com/anurajx/delhiunderground/blob/main/lib/elements/MapDir/svgMap.dart): renderer · SVG/vector map rendering support · `lib/elements/MapDir/svgMap.dart`

### Data services

Route, station, schedule, and location access

- [Route data](https://github.com/anurajx/delhiunderground/blob/main/lib/elements/RouteDir/routeDataProvider.dart): provider · Supplies route metadata and route computation inputs · `lib/elements/RouteDir/routeDataProvider.dart`
- [Schedules](https://github.com/anurajx/delhiunderground/blob/main/lib/elements/ServicesDir/scheduleService.dart): service · Primary schedule access and timetable logic · `lib/elements/ServicesDir/scheduleService.dart`
- [New schedule](https://github.com/anurajx/delhiunderground/blob/main/lib/elements/ServicesDir/newScheduleService.dart): service · Alternative or updated schedule source · `lib/elements/ServicesDir/newScheduleService.dart`
- [Stop fetcher](https://github.com/anurajx/delhiunderground/blob/main/lib/elements/ServicesDir/stopInfoFetcher.dart): fetcher · Loads stop and station detail data · `lib/elements/ServicesDir/stopInfoFetcher.dart`
- [Gate data](https://github.com/anurajx/delhiunderground/blob/main/lib/elements/ServicesDir/gatesFetcher.dart): fetcher · Loads station gate information · `lib/elements/ServicesDir/gatesFetcher.dart`
- [Hours data](https://github.com/anurajx/delhiunderground/blob/main/lib/elements/ServicesDir/openingClosingFetcher.dart): fetcher · Loads opening and closing time information · `lib/elements/ServicesDir/openingClosingFetcher.dart`
- [Location](https://github.com/anurajx/delhiunderground/blob/main/lib/elements/ServicesDir/geolocatorService.dart): service · Device geolocation and proximity support · `lib/elements/ServicesDir/geolocatorService.dart`
- [Station lists](https://github.com/anurajx/delhiunderground/blob/main/lib/elements/ServicesDir/metroStationsList.dart): registry · Metro station catalogs and helper lists · `lib/elements/ServicesDir/metroStationsList.dart`
- [Mini list](https://github.com/anurajx/delhiunderground/blob/main/lib/elements/ServicesDir/miniMetroStationList.dart): registry · Compact station list variant · `lib/elements/ServicesDir/miniMetroStationList.dart`
- [Data provider](https://github.com/anurajx/delhiunderground/blob/main/lib/elements/ServicesDir/data_Provider.dart): provider · Shared data access and station model plumbing · `lib/elements/ServicesDir/data_Provider.dart`
- [Station model](https://github.com/anurajx/delhiunderground/blob/main/lib/elements/ServicesDir/Station_element.dart): model · Shared station element used across features · `lib/elements/ServicesDir/Station_element.dart`
- [Error reports](https://github.com/anurajx/delhiunderground/blob/main/lib/elements/ServicesDir/reportErrorService.dart): service · Error reporting and feedback path · `lib/elements/ServicesDir/reportErrorService.dart`

### Bundled data

Offline transit data and UI assets

- [Map assets](https://github.com/anurajx/delhiunderground/tree/main/assets/Map): transit data · Station, gate, shape, and map-style datasets · `assets/Map`
- [Timetables](https://github.com/anurajx/delhiunderground/tree/main/assets/TimeTable): transit data · Route and day-specific CSV schedules · `assets/TimeTable`
- [Local data](https://github.com/anurajx/delhiunderground/blob/main/assets/routes.db): bundle · SQLite, JSON, and CSV transit data bundled with the app · `assets/routes.db`

## Connections

- 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
