Splash Module

← App map · The app boots behind the native splash: get_it registers the logic layer, AppLogic.bootstrap() loads saved state, and GoRouter swaps the hidden / route for the intro or home.

Screenshots scroll sideways · tap to enlarge

What it does

main() keeps the native splash on screen (FlutterNativeSplash.preserve), registers 10 lazy singletons with get_it (8 logic classes plus ArtifactAPIService and NativeWidgetService) and starts WondersApp, a MaterialApp.router on the global appRouter whose locale follows SettingsLogic.currentLocale. Views reach logic through 8 top-level getters (appLogic, wondersLogic, settingsLogic…); services deliberately get no shortcut. bootstrap() then sets a 380×650 minimum window on desktop, loads the map-marker bitmap, asks Android for its highest refresh rate, loads settings and strings, builds the 8 wonders, the timeline events and the collectibles, waits 1 ms so GoRouter can catch a deep link, flips isBootstrapComplete and goes to /welcome on first run, otherwise to the saved deep link or /home (inside Router.neglect, so / never becomes a back target). Until then _handleRedirect sends every path to / and remembers the first as the deep link; afterwards it sends /, and /welcome once onboarding is done, to /home. Settings and collectibles are JSON strings in SharedPreferences (settings.dat, collectibles.dat), saved at most once every 2 s by Throttler. Every screen is an AppRoute: a Cupertino page (swipe back) or a fade when useFade is set or animations are off, and ScreenPaths appends nested pages (video, search, maps, timeline, artifact, collection) to the current path so back returns where you came from.

Logic class diagram

One composition root: get_it owns every logic singleton, AppLogic runs them in order at boot, and the router reads two of their flags to decide where the app may go.

Screen widget composition

A ShellRoute wraps every screen in WondersAppScaffold, which rebuilds the shared AppStyle from the screen size; each route then picks a swipe-back or a fade page.

Launch the app sequence

Cold start: the native splash stays up until bootstrap finishes, then the router replaces the empty / route.

Key files