BundleResources class

Read/write surface for one reserved folder under a bundle's .mbd/ root. All paths are forward-slash separated and resolved relative to the folder root — absolute paths and .. traversal are rejected.

Constructors

BundleResources({required String bundleRoot, required BundleFolder folder})
Bind to <bundleRoot>/<folder.name>.

Properties

folder BundleFolder
Which reserved folder this surface points at.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

delete(String relativePath) Future<void>
Delete the file. No-op when missing.
exists(String relativePath) Future<bool>
Whether the file exists.
list({String? extension}) Future<List<String>>
Enumerate files under this folder.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read(String relativePath) Future<String>
Read file contents as UTF-8 text.
readBytes(String relativePath) Future<Uint8List>
Read file contents as raw bytes.
readJson(String relativePath) Future
Decode relativePath as JSON text. Convenience wrapper around read + jsonDecode so callers don't repeat the boilerplate.
toString() String
A string representation of this object.
inherited
write(String relativePath, String content) Future<void>
Write UTF-8 text. Creates parent directories as needed.
writeBytes(String relativePath, Uint8List bytes) Future<void>
Write raw bytes. Creates parent directories as needed.
writeJson(String relativePath, Object? value, {int indent = 2}) Future<void>
JSON-encode value and write as UTF-8 text. Creates parent directories as needed. indent controls pretty-printing — 0 emits a single line with no padding; > 0 uses that many spaces. Symmetric with readJson so callers stop repeating jsonEncode + write.

Operators

operator ==(Object other) bool
The equality operator.
inherited