6
gitpush
6y

Flutter help please.
When creating a new website, code has the following:

MyHomePage({Key key, this.title}) : super(key: key);

What does {} content mean? Is it like Javascript, that there is an object passed and we take only those two params?

Because this is how they use it:
MyHomePage(title: 'Flutter Demo Home Page'),

I'm not sure what is the "key" thing

Comments
  • 2
    It's a named optional parameter. Also, when calling the function you must use the parameter name
  • 1
    Like @Unoriginal said... also: this way, args order doesn't matter.
  • 0
    @Unoriginal @Cultist Where do I find this in their documentation? I'm still facing issues understanding few things in Flutter
  • 2
    @gitpush it's a feature of Dart, not flutter.
  • 2
    @Cultist I see, so I read more into dart docs for language specific features, and in flutter for UI ?
  • 1
    @gitpush exactly. Take a look at effective dart. Its a pretty good overview over dart for programmers
  • 1
    @musician Thanks, checking it out now.
    So far I'm liking flutter, but need to make a full app before I can either like it or hate it like I do with React Native lol
Add Comment