1 year ago

#77061

test-img

Mahdi Dahouei

Change flutter built_value json naming conventions

I'm consuming an api that uses lowercase_with_underscores naming convention for its jsons' properties:

{
  "user_id": 0,
  "full_name": ""
}

and my built_value class is:

abstract class User implements Built<User, UserBuilder> {
  //...
  @BuiltValueField(wireName: "user_id")
  int get userId;

  @BuiltValueField(wireName: "full_name")
  String get fullName;
  //...
}

is there a way to change built_value serializer naming convention for all built_value classes so that it automatically asigns my_property in json to myProperty in built_value model instead of using BuiltValueField(wireName: "my_property") for each property?

flutter

dart

built-value

0 Answers

Your Answer

Accepted video resources