FormDefCodec class abstract final

Saves a form being filled and restores it later (for app restarts, form caches and JavaRosa's serializeAndDeserializeForm tests).

Replaces JavaRosa's Externalizable FormDef serialization. Instead of a binary object graph it stores the form's source XML, the whole main instance (non-relevant values included) and the language, and restores by parsing again and loading the instance; calculations and relevance are recomputed when the restored form is initialized (initialize(newInstance: false)), as after JavaRosa's deserialization. Restoring costs a parse, which JavaRosa's binary cache avoids.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

cacheKey(String formXml) → String
A cache key for the form XML formXml: invalidated by a different form or codec version.
decode(Uint8List bytes, {ResourceResolver? resolver, XFormParser? parser}) → Future<FormDef>
Restores a form encoded by encode, reading external secondary instances through resolver (or a configured parser). As in JavaRosa's ExternalDataInstance.readExternal, external instances are read again, and a missing file throws ResourceNotFoundException (a client would then parse the form again, using a placeholder).
encode(FormDef form) → Uint8List
Encodes form (parsed by DartRosa's XFormParser).

Constants

version → const int
The encoding version; bump when the format changes.