deregister method

bool deregister(
  1. String prefix
)

Remove MetaPropertyParser with corresponded prefix.

It returns true if the given prefix has been removed.

In additions, if prefix is the same value of primaryPrefix, it will reset to Null.

Since empty MetaPropertyParser.propertyNamePrefix is forbidden in register, it also throws ArgumentError is prefix is an empty String.

Implementation

bool deregister(String prefix) {
  if (prefix.isEmpty) {
    _encounteredEmptyPrefix("prefix");
  }

  if (primaryPrefix == prefix) {
    primaryPrefix = null;
  }

  final int originLength = _parsers.length;
  _parsers.removeWhere(_prefixEquals(prefix));

  return _parsers.length < originLength;
}