ApiField class

A single field inside an ApiModel.

name — the camelCase Dart identifier used in the class. jsonKey — the original JSON key (may differ from name). type — resolved ApiType (carries nullability). required — whether the field is marked required in the spec. description — optional doc comment text. defaultValue — raw default value from the spec (String / num / bool). isReadOnly — spec readOnly: true → emit final (already default). isWriteOnly — spec writeOnly: true → skip in fromJson.

Constructors

ApiField({required String name, required ApiType type, String? rawName, String? jsonKey, bool required = false, String? description, Object? defaultValue, bool isReadOnly = false, bool isWriteOnly = false})
const

Properties

defaultValue Object?
final
description String?
final
effectiveJsonKey String
Returns the effective JSON key: jsonKey if set, otherwise name.
no setter
hashCode int
The hash code for this object.
no setterinherited
isReadOnly bool
final
isWriteOnly bool
final
jsonKey String?
final
name String
final
rawName String?
The raw (un-camelCased) field name from the spec. Used to reconstruct jsonKey when needed.
final
required bool
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type ApiType
final

Methods

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

Operators

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