isMatchingType<T> method

bool isMatchingType<T>(
  1. T value
)

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

// Create a new document
final doc = SchemaDocument();

// Check if the field 'name' is a String
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;
}