getEnum<T extends Enum> method

T getEnum<T extends Enum>(
  1. int index, {
  2. required T parser(
    1. dynamic
    ),
  3. dynamic innerMapKey,
  4. int? innerIndex,
  5. T? defaultValue,
  6. Map<String, dynamic>? debugInfo,
})

Converts the element at index to an enum value using parser.

Implementation

T getEnum<T extends Enum>(
  int index, {
  required T Function(dynamic) parser,
  dynamic innerMapKey,
  int? innerIndex,
  T? defaultValue,
  Map<String, dynamic>? debugInfo,
}) {
  final info = <String, dynamic>{};
  if (debugInfo != null && debugInfo.isNotEmpty) {
    info.addAll(debugInfo);
  }
  info['index'] = index;
  return ConvertObjectImpl.toEnum<T>(
    _valueAt(index),
    parser: parser,
    mapKey: innerMapKey,
    listIndex: innerIndex,
    defaultValue: defaultValue,
    debugInfo: info,
  );
}