debugAssertIsValid method Null safety

  1. @override
bool debugAssertIsValid()
override

In debug mode, throws an exception if the object is not in a valid configuration. Otherwise, returns true.

This is intended to be used as follows:

assert(myWidgetSpan.debugAssertIsValid());

Implementation

@override
bool debugAssertIsValid() {
  // WidgetSpans are always valid as asserts prevent invalid WidgetSpans
  // from being constructed.
  return true;
}