> For the complete documentation index, see [llms.txt](https://triyono.gitbook.io/fluttercheatsheet/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://triyono.gitbook.io/fluttercheatsheet/usefull-source/constructor.md).

# Constructor

Constructor adalah cara untuk melewatkan data dari Parent widget ke child widget , [Sumber](https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/14951022#content)&#x20;

## FINAL ?

Mengapa didalam constructor harus menggunakan final pada variabel?&#x20;

karena saat kita membuat constructor , variabel yang dibuat tidak boleh diubah dan apabila di ubah maka tidak akan berpengaruh di pada tampilan ( karena constructor biasanya dibuat dengan stateless, dan saat variabel stateless diubah tidak berpengaruh pada tampilan sebelum di rebuild ulang)

## multi constructor

![Cara buat multi constructor](https://3762189661-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzp3ilcKPKiqfMvAeZF%2F-M0_p9Gq3m6g2aeCvvGj%2F-M0_wmAOqovWRIo9ftku%2Fimage.png?alt=media\&token=469694df-a88e-4c15-b24b-6b20fbe5f271)

![multi constructor with named properties](https://3762189661-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzp3ilcKPKiqfMvAeZF%2F-M0_p9Gq3m6g2aeCvvGj%2F-M0_wysRv5IuCXP9Lrwe%2Fimage.png?alt=media\&token=07de2ddf-dec9-42d3-8c06-5b23b6475d1c)

![Penggunaan ](https://3762189661-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzp3ilcKPKiqfMvAeZF%2F-M0_p9Gq3m6g2aeCvvGj%2F-M0_xC78npL542wckj-P%2Fimage.png?alt=media\&token=cd2950b1-e435-4e46-8328-43793473f80f)

{% embed url="<https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/learn/lecture/14912662#bookmarks>" %}
Sumber
{% endembed %}
