Search code examples
calendardartbootjack

Dart TreeSanitzer: No static getter 'trusted' declared in class 'NodeTreeSanitizer'


I'm using the Bootjack Datepicker and after upgrading Dart to 1.12.1, I'm all of a sudden seeing only half a calendar with no days and with this exception:

Exception: No static getter 'trusted' declared in class 'NodeTreeSanitizer'. NoSuchMethodError: method not found: 'trusted' Receiver: Type: class 'NodeTreeSanitizer'

This is the only line of code needed to wire the calendar:

Calendar.use();

If you need to manually wire the calendar, you can manually call:

Calendar.wire(querySelector("div.calendar"));

Both of them are giving me the exception in calendar.dart

The code that seems to be breaking is:

void _dayView() {
    TableElement calBody = element.querySelector('.cnt');
    Element dow = calBody.tBodies[0].createFragment(_DOW_TEMPLATE).children[0];
    List<Element> children = dow.children;

    List<String> swkDays = _dfmt.dateSymbols.SHORTWEEKDAYS;
    int ofs = (_firstDayOfWeek + 1) % 7;
    //render week days
    for (int i = swkDays.length; --i >= 0;) {
      children[i].text = swkDays[(i + ofs) % 7];
    }

    var buffer = new StringBuffer();
    for (int i = 6; --i >= 0;) {
      buffer.write(_DAYROW_TEMPLATE);
    }

    calBody.tBodies[0]
    ..append(dow)
    ..appendHtml(buffer.toString(), treeSanitizer: NodeTreeSanitizer.trusted);   <<<<<<<< ERROR
  }

Looking at appendHtml, I can see treeSanitizer is an optional param, so that syntax looks fine. In the abstract class NodeTreeSanitizer, I can see: static const trusted = const _TrustedHtmlTreeSanitizer();, so that seems to be fine as well.

Any idea what could be causing this error?

I've logged a bug here in the meantime: https://github.com/rikulo/bootjack-datepicker/issues/2


Solution

  • Looks like your Dartium version is outdated.
    Please compare the output of dart --version (command line) and the Dart version on the about://version page in Dartium.