Search code examples
templatesdartmustache

Dart Error : Class '_Template' has no instance method 'render' with matching arguments


When the below chunk of DART program is executed, error "Breaking on exception: Class '_Template' has no instance method 'render' with matching arguments." is thrown.

var source = '{{#data}}<div>{{title}},{{time}}</div>{{/data}}';
var template = mustache.parse(source);
var output;
output = template.render({'guide_data_cell': [{'title': 'friends','time': '10:00 PM'}]});

Please help if I missed any syntax.


Solution

  • According to the package:mustache docs, render() requires both a values map and a StringSink, or you can use renderString() which only requires a values map.

    If you're using the Dart Editor, it should show a warning on the call to render() for the mismatched arguments.