MessageField constructor

MessageField(
  1. Message message,
  2. String name,
  3. dynamic fieldType,
  4. bool optional,
  5. bool array,
)

Implementation

MessageField(this.message, this.name, dynamic fieldType, this.optional, this.array) {
    if (fieldType is String && reBinary.hasMatch(fieldType)) {
        final int length = int.tryParse(fieldType.substring(6)) ?? 0;
        if (length <= 0) throw Exception('Invalid binary data length for "$name" in "${message.filename}".');
        type = 'binary';
        binary = true;
        binaryLength = length;
    }
    else {
        type = fieldType;
        binary = false;
        binaryLength = 0;
    }
}