Skip to content

Improvement custom field #26

@Rodrigolmti

Description

@Rodrigolmti

Hi, this is a great package thanks for sharing. I did look at the documentation and did not see anything like...

For example, I have the class

class UserResponse { final String profile; ... }

And I have

enum UserProfile { investor, consumer }

class User {
final UserProfile profile;
...
}

How can I make the mapper to map with a custom logic for example:

profile: enumFromString<UserProfile>(
    UserProfile.values,
    response.profile,
    UserProfile.consumer,
  )

for the profile field. This is just one example there is several more like

class UserResponse {
   final String zipCode;
   final String number;
   final String street;
...
}

Map to

class User {
   final Address address;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions