InlineString class final
A destination for a string field: its UTF-8 bytes.
The codec validates a bound string's bytes once the payload is whole and
reports invalid UTF-8 as INVALID (CORELIB_PLAN §6.4) — a skipped string is
never inspected. The Dart String is built only when asked for, by
toString.
- Inheritance
-
- Object
- InlineBytes
- InlineString
Constructors
- InlineString(int capacity)
-
Storage for
capacitybytes, empty. - InlineString.of(String value)
-
valueencoded as UTF-8, length set to match. Throws SofabError.invalidArgument for an unpaired surrogate, which has no UTF-8 encoding.
Properties
- capacity → int
-
How many bytes storage holds.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- length ↔ int
-
The number of bytes in use.
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- storage ↔ Uint8List
-
The bytes; the first length are in use.
getter/setter pairinherited
Methods
-
assign(
List< int> bytes) → void -
Replaces the contents with
bytes, growing storage if it must.inherited -
assignString(
String value) → void -
Replaces the contents with
valueencoded as UTF-8, growing storage if it must. Throws SofabError.invalidArgument for an unpaired surrogate. -
ensureCapacity(
int n) → void -
Grows storage to hold at least
nbytes, keeping the first length.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toBytes(
) → Uint8List -
The bytes in use, copied into a new list.
inherited
-
toString(
) → String -
The string in use, decoded. An all-ASCII payload skips the UTF-8 decoder.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited