debugAssertIsValid method

  1. @override
bool debugAssertIsValid ()
override

In checked 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 (InlineSpan child in children) {
        assert(child != null,
          'TextSpan contains a null child.\n...'
          'A TextSpan object with a non-null child list should not have any nulls in its child list.\n'
          'The full text in question was:\n'
          '${toStringDeep(prefixLineOne: '  ')}'
        );
        assert(child.debugAssertIsValid());
      }
    }
    return true;
  }());
  return super.debugAssertIsValid();
}