JsonModelReader constructor

JsonModelReader(
  1. Object? source, {
  2. String path = '',
})

Wraps source, the decoded JSON object to read. A non-map source (null, a list, a scalar) is treated as an empty object, so every required read reports a missing-field error rather than throwing a cast error. path prefixes the ValidationErrorUtils.path of each error, letting a nested reader report address.city instead of a bare city. Audited: 2026-06-12 11:26 EDT

Implementation

JsonModelReader(Object? source, {String path = ''})
  : _map = source is Map ? source : const <Object?, Object?>{},
    _path = path;