Outils pour utilisateurs

Outils du site


flutter

Ceci est une ancienne révision du document !


Flutter

POO

Constructeur avec paramètres nommés

class Test {
  // ...
  
  // Test(foo: 'foo', bar: 'bar');
  Test({ String foo, String bar})
}

Constructeur avec paramètres nommés & obligatoires

class Test {
  // ...
  
  // Test(bar: 'bar') => throw an exception because foo does not exist
  Test({ required String foo, String bar})
}

Surcharger un constructeur

class Test {
  // ...
  Test({super.key, this.foo});
  
  Test.foo({super.key}) {
    foo = 'foo';
  }
}

Librairies externes

* Smooth page indicator

Paramètres nommés requis: ({ @required String foo, String bar }) ⇒ foo obligatoire Classname({ this.foo, this.bar }) ⇒ shortcut

Surcharger un constructeur: class Person {

String name;
int age;
Person({this.name, this.age})
Person.newBorn({this.name}) {
  this.age = 0;
}

}

Widgets: * SafeArea pour ignorer le haut du device Librairie: * smooth_page_indicator

flutter.1662841452.txt.gz · Dernière modification : 2022/09/10 20:24 de alyve