19 lines
881 B
Dart
19 lines
881 B
Dart
import 'dart:io';
|
|
|
|
/// Holds filesystem paths that are resolved once during app startup so they can
|
|
/// be read synchronously from widget `build()` methods (which cannot await the
|
|
/// async `path_provider` lookups). [documentsDir] is populated in `main()`
|
|
/// before `runApp`.
|
|
class AppPaths {
|
|
/// Absolute path to the app's documents directory. Set exactly once during
|
|
/// startup; reading it before that completes throws (intentional — surfaces
|
|
/// an init-order bug instead of silently using an empty path).
|
|
static late final String documentsDir;
|
|
|
|
/// Persistent location of the user-chosen chat background image. Constant
|
|
/// filename, so replacing the image overwrites in place — callers must
|
|
/// `evict()` it from the image cache after writing.
|
|
static String get chatBackgroundImage =>
|
|
'$documentsDir${Platform.pathSeparator}chat_background.img';
|
|
}
|