The code is the constructor of the MyHomepage widget.
{Key key, this.title}
It declares two optional named parameters (optional named because of {}) where
-
the first is of name
keywith typeKey -
the second is of name
titlewith the type of the fieldthis.titleand automatically initializesthis.titlewith the passed value. This is nice syntactic sugar that saves some writing.
: starts the initializer list.
The initializer list allows some to execute some expressions before the call is forwarded to the constructor of the super class.
When a class is initialized, read access to this is forbidden until the call to the super constructor is completed (until the body of the constructor is executed – in your example the constructor has no body).
The initializer list is often use to validate passed parameter values with assert(key != null) or to initialize final fields with calculated values (final fields can’t be initialized or updated later).
super(key: key) forwards to the constructor of the super class and passes the parameter key passed to MyHomepage to the super constructors key parameter (same as for MyHomepage({Key key})).