diff --git a/lib/pages/welcome.dart b/lib/pages/welcome.dart index 017fedc..db2d6a3 100644 --- a/lib/pages/welcome.dart +++ b/lib/pages/welcome.dart @@ -935,12 +935,16 @@ class _DocReaderSheet extends StatefulWidget { } class _DocReaderSheetState extends State<_DocReaderSheet> { - late final Future _content; + Future? _content; @override - void initState() { - super.initState(); - _content = _load(); + void didChangeDependencies() { + super.didChangeDependencies(); + // `_load()` needs `Localizations.localeOf(context)`. That call + // touches InheritedWidgets which aren't safe to read in + // initState() — must wait until didChangeDependencies. We + // gate on `_content == null` so it runs exactly once. + _content ??= _load(); } Future _load() async {