draw method Null safety

void draw(
  1. {required Drawable drawable,
  2. required Vector2 position,
  3. required int priority,
  4. bool cameraRelative = true}
)

Implementation

void draw(
    {required Drawable drawable,
    required Vector2 position,
    required int priority,
    bool cameraRelative = true}) {
  // DrawableObject
  if (drawable is DrawableObject) {
    drawObject(
        drawable: drawable,
        position: position,
        priority: priority,
        cameraRelative: cameraRelative);
  }
  // DrawableText
  else if (drawable is DrawableText) {
    systems.textSystem.drawText(
        drawable: drawable,
        position: position,
        priority: priority,
        cameraRelative: cameraRelative);
  }
  // DrawableObjectList
  else if (drawable is DrawableObjectList) {
    _renderQueue.allocate().setRaw(
        priority: priority,
        data: drawable.data!,
        textureRegion: drawable.textureRegion!,
        color: drawable.color);
  } else {
    print('not supported element');
  }
}