getNames method

List<String?> getNames({
  1. String? prefix,
  2. List<String?>? out,
})

Gets a list of texture names that match the given prefix.

The prefix parameter is used to filter the list of texture names to be returned.

The out parameter is an optional list that will be filled with the matching texture names. If it's not provided, a new list will be created.

Returns the list of matching texture names.

Implementation

List<String?> getNames({String? prefix, List<String?>? out}) {
  prefix ??= '';
  out ??= [];
  if (_subTexturesNames == null) {
    _subTexturesNames = [];
    for (var name in _subTextures!.keys) {
      _subTexturesNames!.add(name);
    }
    _subTexturesNames!.sort();
  }
  for (var name in _subTexturesNames!) {
    if (name!.indexOf(prefix) == 0) {
      out.add(name);
    }
  }
  return out;
}