addTexture method Null safety

void addTexture (
  1. int textureId,
  2. {Offset offset:,
  3. double width: 0.0,
  4. double height: 0.0,
  5. bool freeze: false,
  6. FilterQuality filterQuality: FilterQuality.low}

Adds a backend texture to the scene.

The texture is scaled to the given size and rasterized at the given offset.

If freeze is true the texture that is added to the scene will not be updated with new frames. freeze is used when resizing an embedded Android view: When resizing an Android view there is a short period during which the framework cannot tell if the newest texture frame has the previous or new size, to workaround this the framework "freezes" the texture just before resizing the Android view and un-freezes it when it is certain that a frame with the new size is ready.


void addTexture(
  int textureId, {
  Offset offset =,
  double width = 0.0,
  double height = 0.0,
  bool freeze = false,
  FilterQuality filterQuality = FilterQuality.low,
}) {
  assert(offset != null, 'Offset argument was null'); // ignore: unnecessary_null_comparison
  _addTexture(offset.dx, offset.dy, width, height, textureId, freeze, filterQuality.index);