vsync<V extends GetVsyncAny> method

V vsync<V extends GetVsyncAny>(
  1. V getVsync, {
  2. bool useScope = true,
  3. bool watch = false,
})

Registers a GetVsync object with this RefPaint's context, in a fashion similar to Ref.vsync.

Implementation

V vsync<V extends GetVsyncAny>(V getVsync, {bool useScope = true, bool watch = false}) {
  if (useScope) getVsync = GetScope.of(context, getVsync);
  if (getVsync.maybeVsync case final vsync? when vsync.context == null) {
    _element.vsyncs.add(vsync..context = _element);
  }
  if (watch) {
    this.watch(getVsync);
  }
  return getVsync;
}