You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently there's many different places in the code that look like this:
Map<String, Object?> toJson() => {
for (final key in encoding.keys) key: encoding[key],
_typeKey: type,
}..sortOnKey();
Often this property isn't even used. But when it's used it's problematic because:
it's error prone: As every single toJson() implementation would need to remember this and it's easy to forget to add this
it's redundant code: We have this in many different places.
I suggest we centralize this into one mechanism that can be generally used. A user that requires keys to be sorted can then call it and is guaranteed to get recursively sorted maps in the entire json, e.g.
Map<String, Object?> json;
final jsonSorted =ensureSortedJsonMaps(json); // <-- recursively walks the tree, sorting any maps when needed
The text was updated successfully, but these errors were encountered:
Currently there's many different places in the code that look like this:
Often this property isn't even used. But when it's used it's problematic because:
toJson()
implementation would need to remember this and it's easy to forget to add thisI suggest we centralize this into one mechanism that can be generally used. A user that requires keys to be sorted can then call it and is guaranteed to get recursively sorted maps in the entire json, e.g.
The text was updated successfully, but these errors were encountered: