decodeArray method
Decode an array
Implementation
List<dynamic> decodeArray(dynamic src) {
GsonParsable p = src is GsonParsable ? src : src is String ? new GsonParsable(src) : throw ("The src is not a valid input to decode an Array from");
List<dynamic> arr = [];
bool foundComma = true;
if(p.next() != "[") { throw p.error("Array has to start with a ["); }
while(p.actual() != "]") {
if(!foundComma) { throw p.error("Expected \"]\" or \",\""); }
foundComma = false;
_skipIgnored(p);
if(new RegExp(r'''[\\[\\{\\\"\\\'0-9]''').hasMatch(p.actual()) || _PURE_STRING.hasMatch(p.actual())) { arr.add(decode(p)); }
else { throw p.error('Expected "[", "\\"","\\\'", "{" or a number'); }
_skipIgnored(p);
if(p.actual() == ",") {
foundComma = true;
p.skip();
}
_skipIgnored(p);
}
if(!p.ended){ p.skip(); }
return arr;
}