windows7lake / json2dart

Android Studio plugin use for prasing json to dart class with safe type convert.
4 stars 0 forks source link

Variable names automatically require the first letter to be lowercase. #3

Closed shohrab-swl closed 1 week ago

shohrab-swl commented 1 week ago

{ "Operation": { "OperationID": 1 } }

Only Variable names automatically require the first letter to be lowercase.

class ResponseData { final Operation Operation; // Need automatic lowercase variable name

ResponseData({ required this.Operation, });

factory ResponseData.fromJson(Map<String, dynamic>? json) => ResponseData( Operation: Operation.fromJson(asT<Map<String, dynamic>>(json, 'Operation')), );

Map<String, dynamic> toJson() => { 'Operation': Operation.toJson(), };

ResponseData copyWith({ Operation? Operation,// Need automatic lowercase variable name }) { return ResponseData( Operation: Operation ?? this.Operation, ); } }

class Operation { // 1 final int OperationID;

Operation({ this.OperationID = 0, });

factory Operation.fromJson(Map<String, dynamic>? json) => Operation( OperationID: asT(json, 'OperationID'), );

Map<String, dynamic> toJson() => { 'OperationID': OperationID, };

Operation copyWith({ int? OperationID, }) { return Operation( OperationID: OperationID ?? this.OperationID, ); } }

windows7lake commented 1 week ago

Thanks for your feedback. I will fixed it in few days.

windows7lake commented 1 week ago

@shohrab-swl Fixed now. New package under review, you can download by json2dart-1.2.3.zip