isMatchingType<T> method Null safety

bool isMatchingType<T>(
  1. T value
)

Checks if the provided T type matches the SchemaKind of the SchemaDocumentValue. If the provided T doesnt match SchemaKind, then false is returned.

Example

final doc = SchemaDocument();
for (final field in doc.fields) {
   if(field.isMatchingType<String>()) {
    print("Found a string field!");
  }
}

Implementation

bool isMatchingType<T>(T value) {
  final v = getValue<T>();
  if (v == null) {
    return false;
  }
  return v == value;
}