mirrorsFieldResolver<T> function

T? mirrorsFieldResolver<T>(
  1. dynamic objectValue,
  2. String fieldName, [
  3. Map<String, dynamic>? objectValues
])

Uses dart:mirrors to read field names from items. If they are Maps, performs a regular lookup.

Implementation

T? mirrorsFieldResolver<T>(objectValue, String fieldName,
    [Map<String, dynamic>? objectValues]) {
  if (objectValue is Map) {
    return objectValue[fieldName] as T?;
  } else {
    return reflect(objectValue).getField(Symbol(fieldName)).reflectee as T?;
  }
}