isEnumTypeForValues method

bool isEnumTypeForValues (
  1. Type enumType,
  2. [Iterable enumValuesList]
)

Validate provided enumType against provided enumValues

Implementation

bool isEnumTypeForValues(Type enumType, [Iterable enumValuesList]) {
  final getEnumTypeNameFromString =
      (value) => value.toString().split('.').first;
  final enumValueTypeName = getEnumTypeNameFromString(enumType.toString());
  return enumType == dynamic ||
      (enumValues ?? enumValuesList).every(
          (item) => getEnumTypeNameFromString(item) == enumValueTypeName);
}