MapPropertyStream class

A property stream for JSON object (map) values.

Provides:

  • A future that completes with the full parsed map
  • A stream that replays buffered values and then emits new values (recommended)
  • An unbufferedStream that only emits new values without replay
  • An onProperty callback for reacting to properties as they start parsing
  • Chainable property getters to access nested properties

onProperty Callback

The onProperty callback enables "arm the trap" behavior, firing immediately when a new object property is discovered (before it's fully parsed):

final user = parser.getMapProperty('user');
user.onProperty((property, key) {
  print('Property "$key" started');
  // Set up subscriptions for this property
});

Chainable Access

Access nested properties using the chainable API:

parser.getMapProperty('user')
      .getStringProperty('name')
      .stream.listen(print);
Inheritance

Constructors

MapPropertyStream({required Future<Map<String, Object?>> future, required JsonStreamParserController parserController, required String propertyPath, required Stream<Map<String, dynamic>> liveStream, required Stream<Map<String, dynamic>> replayableStreamFactory()})

Properties

asBool BooleanPropertyStream
no setterinherited
asList ListPropertyStream<Object?>
no setterinherited
asMap MapPropertyStream
no setterinherited
asNull NullPropertyStream
no setterinherited
asNum NumberPropertyStream
no setterinherited
asStr StringPropertyStream
no setterinherited
future Future<Map<String, Object?>>
A future that completes with the final parsed value of this property.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
parserController → JsonStreamParserController
The parser controller used to create and manage property streams.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stream Stream<Map<String, dynamic>>
A stream that emits map snapshots as they are parsed.
no setter
unbufferedStream Stream<Map<String, dynamic>>
A stream that emits map snapshots as they are parsed.
no setter

Methods

boolean(String key) BooleanPropertyStream
Shorthand alias for getBooleanProperty.
inherited
buildPropertyPath(String key) String
Builds the full property path for the given key.
getBooleanProperty(String key) BooleanPropertyStream
Gets a stream for a boolean property at the specified key.
inherited
getListProperty<E extends Object?>(String key, {void onElement(PropertyStream propertyStream, int index)?}) ListPropertyStream<E>
Gets a stream for a list (array) property at the specified key.
inherited
getMapProperty(String key) MapPropertyStream
Gets a stream for a map (object) property at the specified key.
inherited
getNullProperty(String key) NullPropertyStream
Gets a stream for a null property at the specified key.
inherited
getNumberProperty(String key) NumberPropertyStream
Gets a stream for a number property at the specified key.
inherited
getStringProperty(String key) StringPropertyStream
Gets a stream for a string property at the specified key.
inherited
list<E extends Object?>(String key, {void onElement(PropertyStream propertyStream, int index)?}) ListPropertyStream<E>
Shorthand alias for getListProperty.
inherited
map(String key) MapPropertyStream
Shorthand alias for getMapProperty.
inherited
nil(String key) NullPropertyStream
Shorthand alias for getNullProperty.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
number(String key) NumberPropertyStream
Shorthand alias for getNumberProperty.
inherited
onLog(void callback(ParseEvent event)) → void
Registers a callback to receive log events for this property and its descendants.
inherited
onProperty(void callback(PropertyStream propertyStream, String key)) → void
Registers a callback that fires when each object property starts parsing.
str(String key) → dynamic
Shorthand alias for getStringProperty.
inherited
toString() String
A string representation of this object.
inherited

Operators

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