escapedLength static method
Length of text once escaped into a JSON string by Android's JSONObject
or iOS JSONSerialization (both escape / too).
Implementation
static int escapedLength(String text) {
var cost = 0;
for (var i = 0; i < text.length; i++) {
cost += _escapedCost(text.codeUnitAt(i));
}
return cost;
}