hasNestedType function

bool hasNestedType(
  1. MapEntry<String, dynamic> data, {
  2. required String type,
})

Check if data has any child that has type type.

Implementation

bool hasNestedType(MapEntry<String, dynamic> data, {required String type}) {
  final value = data.value as Map<String, dynamic>;
  if (value.containsKey('type')) {
    return value['type'] == type;
  }

  return hasNestedType(value.entries.first, type: type);
}