schema property
The schema carried by this encoding, or null when there is none.
A read convenience -- never a send path
THE MARSHALLING RULE: the RAW fields feed the wire. mimeType goes to
the mime channel verbatim, and the raw schema -- the one withSchema
set -- goes to the schema channel. This getter never feeds a send
path. Send sites under lib/src/ take the raw pair from
encodingWireChannels instead.
Marshalling through this getter would corrupt the value: under the
derived reading, Encoding('foo/bar;') would go out as mime foo/bar
plus an empty schema and arrive as 'foo/bar', where the wire must
carry 'foo/bar;'.
Resolution order
- the raw schema, when withSchema set one -- an explicit schema always wins over a derived one;
- otherwise the tail after the FIRST
;in mimeType, when there is one. That split is a Dart-side display convention, NOT a mirror of canon's parse: measured, canon stores an unrecognised composed string whole and unsplit, under a custom id; - otherwise
null.
Nullability
String? per CONV-2: null means unspecified, canon decides -- no
schema field is set -- and never a binding-chosen default. '' is a
different state, present-but-empty, rendered as a bare trailing ;.
null therefore stands for exactly one state, as the sealed-result
convention (S4) requires of new nullable surface.
Implementation
String? get schema {
final raw = _schema;
if (raw != null) return raw;
final separator = mimeType.indexOf(_schemaSeparator);
if (separator < 0) return null;
return mimeType.substring(separator + 1);
}