parseNodeAttr method

dynamic parseNodeAttr(
  1. dynamic attrs
)

Implementation

parseNodeAttr(attrs) {
  var id = attrs[0];

  if (attrs[0] != '') {
    id = int.parse(attrs[0]);

    id ??= attrs[0];
  }

  var name = '', type = '';

  if (attrs.length > 1) {
    name = attrs[1].replaceFirst(RegExp(r'^(\w+)::'), '');
    type = attrs[2];
  }

  return {id: id, name: name, type: type};
}