import '../parent/ParentViewModel.dart'; import 'ConnectSplash.dart'; class ViewSplash extends ParentViewModel { ConnectSplash connection; ViewSplash(super.context, this.connection); /// Reads the stored servers, deployment history and theme preference, then /// hands them to the screen. The splash is deliberately held for a minimum /// duration so a fast read doesn't make it flash. void bootstrap() async { final started = DateTime.now(); try { final servers = await getDataManager().getServers(); final history = await getDataManager().getDeployments(); final themeMode = await getDataManager().getThemeMode(); const minShow = Duration(milliseconds: 1300); final elapsed = DateTime.now().difference(started); if (elapsed < minShow) await Future.delayed(minShow - elapsed); connection.onBootstrapped(servers, history, themeMode); } catch (error) { handleError(error, bootstrap, () {}, "Retry"); } } }