Google is committed to advancing racial equity for Black communities. See how.

ChildViewConnection constructor

ChildViewConnection(dynamic viewHolderToken, {dynamic viewRef, ChildViewConnectionCallback onAvailable, ChildViewConnectionCallback onUnavailable, ChildViewConnectionStateCallback onStateChanged, bool usePlatformView: false})

Creates this connection from a ViewHolderToken.

Implementation

ChildViewConnection(
  this.viewHolderToken, {
  this.viewRef,
  this.onAvailable,
  this.onUnavailable,
  this.onStateChanged,
  this.usePlatformView = false,
})  : assert(viewHolderToken?.value != null),
      assert(viewRef == null || viewRef.reference.handle.isValid) {
  if (viewHolderToken.value.isValid && !usePlatformView) {
    _sceneHost = SceneHost(
        viewHolderToken.value.passHandle(),
        (onAvailable == null)
            ? null
            : () {
                onAvailable(this);
              },
        (onUnavailable == null)
            ? null
            : () {
                onUnavailable(this);
              },
        (onStateChanged == null)
            ? null
            : (bool state) {
                onStateChanged(this, state);
              });
  }
}