ObjectInfo class

Metadata about a stored object.

Returned by StorageBackend.head and StorageBackend.list. Contains everything needed to decide what to do with an object without reading its body.

Field guarantees (do NOT loosen these casually)

Every field below has a contract that holds on every backend cellar ships with (Local, IndexedDB, Cellar.atPath). If you add a backend that can't honor a field, you have two choices:

  1. Change the backend so it CAN honor the field (preferred — usually means cellar-side bookkeeping, e.g. IndexedDB stores lastModified in its own record because IDB has no native timestamp).
  2. Reject the backend. If a substrate genuinely cannot deliver one of these fields, it is not eligible to be a cellar backend.

Do NOT make a field nullable to "support" a backend that can't deliver it. Nullable fields here have a real reason (see per-field notes below); adding more nullable fields silently breaks the cross-backend contract callers depend on.

If you find yourself wanting to add an optional field "for one backend," stop and re-read the architecture doc — the answer is almost always "the backend stores it itself" not "the contract bends."

Constructors

ObjectInfo({required String key, required int size, required DateTime lastModified, String? contentType, Map<String, String> metadata = const {}})
All fields are required except the nullable contentType.
const

Properties

contentType String?
MIME type (e.g. "audio/mpeg", "image/png").
final
hashCode int
The hash code for this object.
no setteroverride
key String
The storage key (e.g. "user/u1/photos/sunset").
final
lastModified DateTime
Last modification timestamp (UTC).
final
metadata Map<String, String>
Custom key-value metadata.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size int
Size of the object body in bytes.
final

Methods

copyWith({String? key, int? size, String? contentType, Map<String, String>? metadata, DateTime? lastModified}) ObjectInfo
Create a copy with some fields replaced.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
Identity equality: key + size + contentType only. metadata and lastModified are deliberately excluded — a metadata edit or a timestamp refresh describes the SAME object, and set/dedup logic relies on that. Compare those fields explicitly when they matter.
override