Created by: b1rdG
Just create a toJson method for enum serialization. As you can see on: https://github.com/OpenAPITools/openapi-generator/issues/4157#issuecomment-621370059 :
On the version 4.3.1 the serialize function delegate on dart convert library json.encode(). It return an error because serializing this enums because the enum is not "encodable" (is not a number, boolean, string, null, list or a map), so the encode() method looks for a toJson() on the Object passed:
/// If [toEncodable] is omitted, it defaults to a function that returns the
/// result of calling `.toJson()` on the unencodable object.
So I implemented this method on the template.