updateSprite method

void updateSprite(
  1. T key,
  2. Sprite sprite
)

Updates the sprite for the given key.

Implementation

void updateSprite(T key, Sprite sprite) {
  assert(
    _sprites != null,
    'This call can only be made after the sprites map has been initialized, '
    'which should be done in either the constructor or in onLoad.',
  );
  _sprites?[key] = sprite;
  _resizeToSprite();
}