Component class abstract

The base class to create a component. Every component extends from this class and defines props, tagName, template, style and methodRegistry. A Component structure must be like the following syntax:

class ComponentName extends Component {
  String var = "example prop";
  @override
  Future<String> get template async => await "<p>{{var}} works</p>";
  @override
  Map<String, dynamic> get props => {"var": var};
}

Also can be used with the loadFile() method to use an extern template.

class ComponentName extends Component {
 @override
 Future<String> get template async => await loadFile('path/to/component_name.html');
}
Inheritance

Constructors

Component()

Properties

hashCode int
The hash code for this object.
no setterinherited
host ↔ HTMLElement
getter/setter pairinherited
imports List<Component>
no setteroverride
methodRegistry Map<String, Function>
no setterinherited
props Map<String, dynamic>
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
style Future<String?>
no setterinherited
template Future<String>
no setterinherited

Methods

afterRender() → void
inherited
build() → HTMLElement
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
render() Future<void>
inherited
setState(void updater()) → void
inherited
toString() String
A string representation of this object.
inherited

Operators

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