createFieldIndex method

Map<String, int> createFieldIndex()

Implementation

Map<String, int> createFieldIndex() {
  var identifierPattern = RegExp(r'^[a-zA-Z][a-zA-Z0-9_]*$');
  var fieldIndex = <String, int>{};
  for (var i = 0; i < fieldPackets!.length; i++) {
    var name = fieldPackets![i].name!;
    if (identifierPattern.hasMatch(name)) {
      fieldIndex[name] = i;
    }
  }
  return fieldIndex;
}