SettingsFile class final
Where a game keeps what the player changed.
The stored half of GameConfig, and nothing more: which document, what goes
in it, and what to do when it is not there. Where it goes is Storage's,
because that answer is per platform and was wrong on two of the four — see
that file, which carries the whole story.
Still no path_provider. Three platforms answer with an environment
variable and two with the parent of their temporary directory, which is a
documented assumption rather than a dependency, and it keeps this testable
with a map in memory.
Constructors
- SettingsFile({required String appName, Storage? storage, IssueSink? onIssue})
Properties
- appName → String
-
Which game this is. Two applications sharing one document would have each
overwrite the other's bindings, and finding that out takes a while because
it only happens if you play both.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- onIssue → IssueSink
-
Where this says what it could not read.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- storage → Storage
-
Where the document is kept, which differs per platform — see
Storage.final
Methods
-
clear(
) → void - Forgets everything the player has changed.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
) → GameConfig - Reads the config, or hands back defaults.
-
toString(
) → String -
A string representation of this object.
inherited
-
write(
GameConfig config) → bool - Writes the config, and says whether it managed to.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited