debugAssertIsValid method

  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(myTextSpan.debugAssertIsValid());

Implementation

@override
bool debugAssertIsValid() {
  assert(() {
    if (children != null) {
      for (final InlineSpan child in children!) {
        assert(child.debugAssertIsValid());
      }
    }
    return true;
  }());
  return super.debugAssertIsValid();
}