current property

T get current

A reference to the latest instance of the rendered component.

See createRef for usage examples and more info.

Implementation

T get current {
  final jsCurrent = jsRef.current;

  // Note: this ReactComponent check will pass for many types of JS objects,
  // so don't assume for sure that it's a ReactComponent
  if (jsCurrent is! Element && jsCurrent is ReactComponent) {
    final dartCurrent = jsCurrent.dartComponent;

    if (dartCurrent != null) {
      return dartCurrent as T;
    }
  }
  return jsCurrent as T;
}
set current (T value)

Implementation

set current(T value) {
  if (value is Component) {
    jsRef.current = value.jsThis;
  } else {
    jsRef.current = value;
  }
}