SimpleTag class

A tag simplifies the implementation of simple tags. For example,

import 'package:stream/rspc.dart';

void main(List<String> arguments) {
  tags["m"] = SimpleTag("m",
    (TagContext tc, String id, Map<String, String> args) {
      if (id == null)
        throw ArgumentError("id required");
      tc.write("\n${tc.pre}response.write(message(connect, $id");
      if (args != null && args.isNotEmpty) {
        tc.write(", ");
        outMap(tc, args);
      }
      tc.writeln("));");
    });

  build(arguments,
    imports: ["package:foo/server/intl.dart"]);
}
Inheritance

Constructors

SimpleTag(String name, _Output output, {bool idFirst = true, bool stringFirst = true})
Constructors a tag.

Properties

hasClosing → bool
Whether this tag requires a closing tag, such as [/if].
no setteroverride
hasContent → bool
Whether this tag generates any content to the response's output.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
idFirst → bool
final
name → String
The tag name.
final
output → _Output
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stringFirst → bool
final

Methods

begin(TagContext tc, String data) → void
Called when the beginning of a tag is encountered.
override
end(TagContext context) → void
Called when the ending of a tag is encountered.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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