toMap method
- EnumMethod? enumMethod,
Converts instance to a map.
Implementation
Map<String, dynamic> toMap({EnumMethod? enumMethod}) {
return {
"data": data,
"ports": ports?.map((e) => e.toMap(enumMethod: enumMethod)).toList(),
"type": switch (enumMethod ?? EnumMethod.nativeValue) {
EnumMethod.nativeValue => type.toNativeValue(),
EnumMethod.value => type.toValue(),
EnumMethod.name => type.name(),
},
};
}