toMap method

Map<String, dynamic> toMap({
  1. EnumMethod? enumMethod,
})

Converts instance to a map.

Implementation

Map<String, dynamic> toMap({EnumMethod? enumMethod}) {
  return {
    "exitCode": exitCode,
    "failureSourceModulePath": failureSourceModulePath,
    "frameInfos": frameInfos
        ?.map((e) => e.toMap(enumMethod: enumMethod))
        .toList(),
    "kind": switch (enumMethod ?? EnumMethod.nativeValue) {
      EnumMethod.nativeValue => kind.toNativeValue(),
      EnumMethod.value => kind.toValue(),
      EnumMethod.name => kind.name(),
    },
    "processDescription": processDescription,
    "reason": switch (enumMethod ?? EnumMethod.nativeValue) {
      EnumMethod.nativeValue => reason?.toNativeValue(),
      EnumMethod.value => reason?.toValue(),
      EnumMethod.name => reason?.name(),
    },
  };
}