Special pug tags
A list of special tags you can use in your pug code that generate code in your Dart code.
Last updated
A list of special tags you can use in your pug code that generate code in your Dart code.
Last updated
A slot is a placeholder for a value. It will always take the value of the first valid child.
It is explained in more detailed in the .
Creates a function, and uses the body as what is returned. This allows you to pass functions as parameters.
params: @required String
a list of comma separated parameters your function expects
Example, to pass a builder function to a :
Wraps its child in a builder function that exposes the current .
Quite frequently you may need the current build context in your views:
passing it as a parameter into event handlers on your models
for Theme.of(context) and such common constructions
At any time you need the current context, you can add a builder shortcut. It will write a Builder widget with as its child a function that passes the current context, which you can then use in the child widgets.
No parameters.
Example:
In the above example, if you leave out the builder, you will get an error because theme requires a context. See the generated Dart how it is used.
Widget that lets you listen to the lifecycle of the BuildContext
it is part of.
Useful in combination with Model
and ReactiveModel
, since your model can be informed when the BuildContext
is being initialized, built, rendered and disposed of.
onRender: Function
Called when render is called on the widget
Example:
Re-renders its children if the Listenable it watches updates.
child: @required Object
the rest of the widgets that get rerendered if the watched model updates
In the above example, a user model is passed into the view. If a user is an instance of a Model, and user.notifyListeners() gets called, part below the reactive tag (the .name and .user containers) will automatically be re-rendered.
Note: Requires the Dart library.
onInit: Function
Called when is called on the widget state
onBuild: Function(BuildContext)
Called when is called on the widget state
onDispose: Function
Called when is called on the widget state
For more information, see .
Note: Requires the Dart library.
This widget was made to work well with the . However when using flutter-view, you no longer need to use the ScopedModel and ScopedModelDescendant widgets. Instead, you pass a model into a flutter-view, and use the reactive tag to watch for changes.
watch: @required Listenable
Something to watch for updates. Usually a .
The shortcut tag processor writes a , and an associated builder function which gets called to build the widget layout.
For more information and a more elaborate example, see .