EnumConvertion class

Enum Convertion Methods

Did not want to use any packages, for minimal dependencies, and therefore instead of using json_serialization package or string_to_enum, manually implemented the convertion from Enum to String, inspired by the enum_to_string package.

Enum to String: https://pub.dev/packages/enum_to_string

JSON Serializable: https://pub.dev/packages/json_serializable

Dart playground of the code below: https://dartpad.dev/624647f30ece6b443e8b4a5708f5a87b

Constructors

EnumConvertion()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

convertFromString<T>(List<T> enumValues, String value) → T?
convertToString(dynamic enumItem) String