Skip to content

Conversation

@CarloDotLog
Copy link

Hello,
I've experienced an error with MetaData.fromJson in order.dart file.
In order creation, I received a response like this:

meta_data: [{id: 18, key: community-events-location, value: {ip: xx.xx.xx.xx}}, {id: 23, key: wc_last_active, value: 1603756800},{..}]

where there is an object instead of a string for the "value" tag: value: {ip: xx.xx.xx.xx}.

The named constructor must change from:

MetaData.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    key = json['key'];
    value = json['value'];
  }

to:

MetaData.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    key = json['key'];
    value = json['value'].toString();
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant