Mustache class

Mustache-like converter

given a string like:

var s = 'Hello {{ name }}, how are you?';

this class can replace {{ name }} with the corresponding value in the map:

var m = Mustache({'name': 'David'});
m.convert(s);

will return Hello David, how are you?

Inheritance

Constructors

Mustache({Map<String, dynamic> map = const <String, dynamic>{}, Map<String, MustacheFilter> filters = const <String, MustacheFilter>{}, bool debug = false, String replace(String key)?})
Create a Mustache instance that can replace strings according to map and filters

Properties

debug bool
Wether or not to display debug information instead of the actual replacement
final
filters Map<String, MustacheFilter>
Filters to apply to the map used to apply filters. This string {{ key | date }} will be replaced with filters['date'](value)
final
hashCode int
The hash code for this object.
no setterinherited
map Map<String, dynamic>
Variable replacement map used to replace {{ key }} with the corresponding value
final
replace → (String Function(String key)?)
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

bind(Stream<String> stream) Stream<String>
Transforms the provided stream.
inherited
cast<RS, RT>() Converter<RS, RT>
Provides a Converter<RS, RT> view of this stream transformer.
inherited
convert(String input) String
Converts input and returns the result of the conversion.
override
fuse<TT>(Converter<String, TT> other) Converter<String, TT>
Fuses this with other.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
startChunkedConversion(Sink<String> sink) Sink<String>
Starts a chunked conversion.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited