HostBinding class

Declares a host property on the host component or element.

This annotation is valid on:

  • Public class members
  • The class members may either be fields or getters
  • The class members may either be static or instance

This annotation is inherited if declared on an instance member.

If hostPropertyName is not specified, it defaults to the property or getter name. For example in the following, 'title' is implicitly used:

class ImplicitName {
  // Same as @HostBinding('title')
  final title = 'Hello World';

These bindings are nearly identical to using the template syntax to set properties or attributes, and are automatically updated if the referenced class member, instance or static, changes:

class HostBindingExample {
  // Similar to <example [value]="hostValue"> in a template.
  String hostValue;

  // Similar to <example [attr.debug-id]="debugId"> in a template.
  String debugId;


HostBinding([String hostPropertyName])


hashCode int
The hash code for this object. [...]
read-only, inherited
hostPropertyName String
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toString() String
Returns a string representation of this object.


operator ==(Object other) bool
The equality operator. [...]