I recently started running into an issue, where, when building my Flutter in release mode to deploy to Play Console's internal testing track, some of my functions in Flutter started failing.
For context, I have EventChannels that stream data from a native function to Flutter, from which I construct a Flutter object.
After countless hours of investigation, it turned out that, in debug mode, the JSON string I'm constructing in Kotlin, contains the correct keys, however, when doing the same thing in release, the keys turn to a:, b:, c:, etc.
At this point in time, I've got no obfuscation enabled in the app, and I'm not too sure why this would have suddenly broke.
I can't cater for the actual names, and alphabetical values in my toJson() function on my class, so want to know how, in release, can I get my parameter values back?
The kotlin class that's encoded to JSON looks like this:
class ScanResponseModel(var name: String, var mac: String, var axis: String, var number : String)
The json output for this, in DEBUG
, looks like this:
[{
"name":"2325",
"mac":"D4:1C:32:33:EE:1F",
"axis":"left",
"number":"0002325"
}, {
"name":"2122",
"mac":"DC:20:3F:E7:05:B7",
"axis":"right",
"number":"0002122"
}]
The exact same output in RELEASE
, looks like this:
[{
"a":"2325",
"b":"D4:1C:32:33:EE:1F",
"c":"left",
"d":"0002325"
},
{
"a":"2122",
"b":"DC:20:3F:E7:05:B7",
"c":"right",
"d":"0002122"
}]