<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by dendimuhmd on Medium]]></title>
        <description><![CDATA[Stories by dendimuhmd on Medium]]></description>
        <link>https://medium.com/@muhammaddendi27?source=rss-6a7216df2483------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*fvWfu1aHJE1XT975kcYySg.jpeg</url>
            <title>Stories by dendimuhmd on Medium</title>
            <link>https://medium.com/@muhammaddendi27?source=rss-6a7216df2483------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 06:59:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@muhammaddendi27/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Unit Testing]]></title>
            <link>https://medium.com/@muhammaddendi27/unit-testing-141a69c515c1?source=rss-6a7216df2483------2</link>
            <guid isPermaLink="false">https://medium.com/p/141a69c515c1</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[unit-testing]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[dendimuhmd]]></dc:creator>
            <pubDate>Thu, 23 Jun 2022 12:56:10 GMT</pubDate>
            <atom:updated>2022-06-23T13:13:06.675Z</atom:updated>
            <content:encoded><![CDATA[<p>Pada latihan ini kita akan menulis skenario pengujian pertama kita. Pengujian pada Flutter terbagi dalam langkah-langkah berikut:</p><ol><li>Menambahkan package <strong>test</strong> atau <strong>flutter_test</strong>.</li><li>Membuat berkas <em>testing</em>.</li><li>Membuat kelas <em>testing</em>.</li><li>Menuliskan skenario pengujian.</li><li>Menjalankan pengujian.</li></ol><p>Untuk memudahkan <em>testing</em>, pisahkan kode-kode yang berupa logika bisnis dan kode yang berperan menampilkan UI. Penerapan <em>state management</em> seperti <em>provider</em> telah memudahkan proses kita menguji. Karena dengan <em>provider</em>, kode logika bisnis akan diletakkan pada kelas <em>provider</em>.</p><p>Pada latihan ini mari gunakan <em>project</em> yang telah kita buat pada materi <em>state management</em> dengan <em>provider</em>.</p><ol><li>Setelah <em>project</em> siap dan terbuka di IDE, hal pertama yang perlu disiapkan adalah package <a href="https://pub.dev/packages/test">test</a>. <em>Package</em> ini akan otomatis terpasang ketika Anda membuat <em>project</em> pertama kali. Pada berkas <strong>pubspec.yaml </strong><em>package</em> termasuk ke dalam <em>dependency </em><strong>flutter_test</strong>.</li></ol><ul><li>dev_dependencies:</li><li>flutter_test:</li><li>sdk: flutter</li></ul><p>2. Sekarang mari buat berkas baru yang akan menjalankan skenario pengujian. Umumnya, berkas <em>testing</em> pada Flutter akan disimpan di dalam folder <strong>test</strong>. Ketika membuat <em>project</em> Flutter pertama kali, aplikasi Counter juga dilengkapi dengan satu contoh <em>testing</em> yang ada pada berkas <strong>widget_test.dart</strong>.</p><p>3. Anda dapat menghapus berkas <strong>widget_test.dart</strong> karena tidak akan dibutuhkan saat ini. Kali ini kita akan menguji kelas <em>provider</em>. Silakan buat berkas pengujiannya. Dalam membuat berkas pengujian, disarankan agar sesuai dengan folder utamanya. Oleh karena itu buat berkas bernama <strong>done_module_test.dart</strong> .</p><p>4. Pada berkas yang baru saja dibuat, tambahkan fungsi main yang menjadi fungsi utama untuk dijalankan.</p><p>5. Kemudian panggil fungsi test(). Fungsi ini membutuhkan dua parameter. Parameter pertama adalah deskripsi dari apa yang ingin diuji. Lalu, parameter keduanya berupa <em>anonymous function </em>yang berisi skenario pengujian kita.</p><p>void main() {</p><p>test(‘should contain new item when module completed’, () {</p><p>// Skenario pengujian dituliskan di sini });}</p><p>Deskripsi pengujian yang baik harus menunjukkan ekspektasi apa yang diharapkan dalam pengujian.</p><p>6. Sekarang saatnya kita mulai menuliskan skenario pengujian. Umumnya, penulisan skenario mencakup tiga bagian yang dikenal dengan pola <strong>AAA (Arrange-Act-Assert)</strong>. <strong><em>Arrange</em></strong><em> </em>adalah bagian di mana kita menyiapkan objek dan pengaturan yang akan diuji.</p><blockquote>// arrange</blockquote><p>var doneModuleProvider = DoneModuleProvider();</p><p>var testModuleName = ‘Test Module’;</p><p>7. Lalu, <strong><em>Act</em></strong><em> </em>adalah aksi yang ingin dijalankan. Di sini kita memanggil metode yang akan diuji.</p><blockquote>// act</blockquote><p>doneModuleProvider.complete(testModuleName);</p><p>8. Terakhir, <strong><em>Assert</em></strong> adalah di mana kita memverifikasi nilai yang diekspektasikan dengan hasil pemanggilan metode ketika <em>Act</em>.</p><blockquote>// assert</blockquote><p>var result = doneModuleProvider.doneModuleList.contains(testModuleName);</p><p>expect(result, true);</p><p>9. Keseluruhan kode <strong>done_module_test.dart </strong>akan seperti di bawah ini:</p><p>import ‘package:flutter_test/flutter_test.dart’;</p><h4>void main() {</h4><h4>test(‘should contain new item when module completed’, () {</h4><blockquote>// arrange</blockquote><h4>var doneModuleProvider = DoneModuleProvider();</h4><h4>var testModuleName = ‘Test Module’;</h4><blockquote>// act</blockquote><h4>doneModuleProvider.complete(testModuleName);</h4><blockquote>// assert</blockquote><h4>var result = doneModuleProvider.doneModuleList.contains(testModuleName);</h4><h4>expect(result, true);</h4><h4>});</h4><h4>}</h4><p>10. Baik. Sekarang saatnya menjalankan pengujian. Pada Android Studio klik kanan pada fungsi main() lalu pilih <strong>Run ‘tests in done_module_provider_test’</strong> (shortcut: <strong>Ctrl + Shift + F10</strong>). Pada Visual Studio Code buka berkas <strong>done_module_provider_test.dart</strong> lalu pilih <strong>Run -&gt; Run Without Debugging</strong> (shortcut: <strong>Ctrl + F5</strong>). Anda juga dapat menjalankan pengujian melalui terminal dengan perintah berikut:</p><ul><li>flutter test test/done_module_provider_test.dart</li></ul><p>11. Pengujian akan dijalankan dan Anda akan mendapatkan hasilnya dengan cepat. Pengujian yang berhasil (<em>passed</em>) akan bertanda centang hijau.</p><p>Berikut ini adalah tampilan pengujian yang berhasil pada VS Code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DTDYQ46fgXkTHtMhFY7X-g.png" /></figure><p>12. Selamat! Anda telah berhasil menjalankan <em>automated testing</em>. Kode Anda juga telah lolos dalam pengujian. Lalu, bagaimana jika pengujiannya gagal? Bagaimana kita bisa mengetahui dan menanganinya?</p><p>13. Mari simulasikan dengan membuat pengujian yang gagal secara sengaja dengan mengubah nilai ekspektasinya.</p><p>expect(result, <strong>false</strong>);</p><p>14. Jalankan kembali pengujian. Ketika test gagal (<em>failed</em>), Anda akan ditunjukkan <em>test case</em> mana yang gagal termasuk apa yang membuatnya gagal. Dalam kasus ini, nilai ekspektasi dan aktualnya berbeda.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gB4zhu6Wv32l3ueXZh6Vuw.png" /></figure><p>Jangan lupa untuk membuat test Anda <em>passed</em> kembali ya!</p><p>15. Anda juga bisa mengelompokkan beberapa <em>test</em> yang sejenis ke dalam satu kelompok dengan fungsi group()seperti berikut:</p><p>void main() {</p><p>group(‘Test’, () {</p><p>test(‘should contain new item when module completed’, () {…});</p><p>test(‘Another test case’, () {…})});}</p><h3>Bedah Kode</h3><p>Selamat! Anda telah menyelesaikan latihan dan menuliskan <em>unit testing</em> pertama. Kali ini kita akan membedah kode-kode yang telah kita tulis. Mari kita mulai!</p><p>Yang pertama adalah <em>dependency package</em> untuk <em>testing</em>.</p><ul><li>dev_dependencies:</li><li>flutter_test:</li><li>sdk: flutter</li></ul><p><em>Unit testing</em> membutuhkan <em>package</em> <a href="https://pub.dev/packages/test">test</a> yang berisi fungsionalitas untuk menuliskan pengujian dalam bahasa Dart. Package test ini sudah termasuk ke dalam package <strong>flutter_test</strong> yang disertakan setiap membuat <em>project</em>.</p><p>Penambahan package <strong>flutter_test</strong> juga berbeda dengan <em>package</em> yang biasa kita gunakan. Di mana <em>package</em> <strong>flutter_test</strong> diletakkan pada dev_dependencies. Apa bedanya? Jadi, <em>dependency package</em>terbagi ke dalam dua kategori, yaitu dependencies dan dev_dependencies. <em>Dependencies</em> berisi <em>package</em> yang kita butuhkan untuk menjalankan fitur aplikasi, sementara <em>dev_dependencies</em> berisi <em>package</em> yang hanya diperlukan selama masa <em>development</em>. Artinya, <em>package</em> tersebut tidak akan disertakan ketika aplikasi di-<em>build</em> pada versi rilis.</p><p>Kemudian berkas pengujian harus diletakkan di dalam folder <strong>test</strong>. Menurut <em>convention</em> dari Flutter nama berkas pengujian harus diakhiri dengan <strong>_test.dart</strong>. Hal ini untuk membedakan antara berkas pengujian dan berkas yang akan diuji.</p><p>Ketika membuat <em>test case</em>, pastikan memberikan deskripsi yang jelas seperti apa yang diuji dan hasil apa yang diharapkan. Lalu, tuliskan kode pengujian dalam pola <strong><em>Arrange-Act-Assert</em></strong>. Pastikan pengujian Anda memiliki fungsi <strong>expect()</strong> untuk memverifikasi dan membandingkan nilai yang ingin diuji. Selain <strong>expect()</strong>, Anda juga bisa menggunakan fungsi <strong>verify()</strong> dari package <a href="https://pub.dev/packages/mockito"><strong>Mockito</strong></a> untuk memverifikasi apakah sebuah <em>method</em> dipanggil atau tidak.</p><p>Sebuah tips, apabila bagian arrange digunakan di seluruh test Anda, maka Anda bisa mengeluarkan inisialisasi variabel dan memanfaatkan fungsi <strong>setUp()</strong>. Fungsi <strong>setUp()</strong> akan dijalankan setiap sebelum setiap pengujian dari fungsi test().</p><p>void main() {</p><p><strong>group</strong>(‘Provider Test’, () {</p><p>final testModuleName = ‘Test Module’;</p><p><strong>DoneModuleProvider</strong> doneModuleProvider;</p><p><strong>setUp</strong>(() {</p><p>doneModuleProvider = <strong>DoneModuleProvider();</strong></p><p>});</p><p>test(‘should contain new item when module completed’, () {</p><p>// <strong>act</strong></p><p>doneModuleProvider.complete(testModuleName);</p><p>// <strong>assert</strong></p><p>var result = doneModuleProvider.doneModuleList.contains(testModuleName);</p><p><strong>expect</strong>(<strong>result</strong>, <strong>true</strong>);</p><p>});</p><p>test(‘should not contain item when module removed’, () {</p><p>// <strong>act</strong></p><p>doneModuleProvider.remove(testModuleName);</p><p>// <strong>assert</strong></p><p>var result = doneModuleProvider.doneModuleList.contains(testModuleName);</p><p>expect(result, false);});});}</p><p>Berikut ini adalah beberapa referensi tambahan untuk membantu Anda melakukan unit test:</p><ul><li><a href="https://flutter.dev/docs/cookbook/testing/unit/introduction">An introduction to unit testing</a></li><li><a href="https://flutter.dev/docs/cookbook/testing/unit/mocking">Mock dependencies using Mockito</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=141a69c515c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Error on flutter]]></title>
            <link>https://medium.com/@muhammaddendi27/error-on-flutter-52a522f80cdc?source=rss-6a7216df2483------2</link>
            <guid isPermaLink="false">https://medium.com/p/52a522f80cdc</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[dart]]></category>
            <dc:creator><![CDATA[dendimuhmd]]></dc:creator>
            <pubDate>Sun, 01 May 2022 11:20:12 GMT</pubDate>
            <atom:updated>2022-05-01T11:20:12.332Z</atom:updated>
            <content:encoded><![CDATA[<p>webview error will be stuck because need it android sdk min 19</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1L89Ib24DT-ZaFOtwuthNg.png" /></figure><p>it is error type when ur android sdk under 19</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52a522f80cdc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Method on List of dart]]></title>
            <link>https://medium.com/@muhammaddendi27/method-on-list-of-dart-6dd675a9461b?source=rss-6a7216df2483------2</link>
            <guid isPermaLink="false">https://medium.com/p/6dd675a9461b</guid>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[oop]]></category>
            <dc:creator><![CDATA[dendimuhmd]]></dc:creator>
            <pubDate>Thu, 21 Apr 2022 04:28:07 GMT</pubDate>
            <atom:updated>2022-04-21T04:28:07.136Z</atom:updated>
            <content:encoded><![CDATA[<p>we know if u using List of dart, mostly we will change some data so u can using some method on List of dart, i will describe 2 method mostly used on list</p><ol><li>firstWhere</li></ol><p>this method finding first number on list</p><p>example : list a = [1,2,3];</p><p>a.firstWhere((first)=&gt;first &lt; 3 );//1</p><p>2. where</p><p>this method will finding all number on list</p><p>example : list b = [1,2,3,4,5];</p><p>b.where((x)=&gt; x &lt; 5 );//1,2,3,4</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6dd675a9461b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is different part of and export?]]></title>
            <link>https://medium.com/@muhammaddendi27/what-is-different-part-of-and-export-655c15718f5e?source=rss-6a7216df2483------2</link>
            <guid isPermaLink="false">https://medium.com/p/655c15718f5e</guid>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[dendimuhmd]]></dc:creator>
            <pubDate>Tue, 05 Apr 2022 07:13:52 GMT</pubDate>
            <atom:updated>2022-04-05T07:13:52.392Z</atom:updated>
            <content:encoded><![CDATA[<p>kalau ‘part of’ itu bisa akses private field, kalau export tidak. Kalau export masing2 component itu ‘satu entitas’ kalau poart of. Seluruh part of itu lah yg ‘satu entitas’</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=655c15718f5e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dart OOP-equals operator]]></title>
            <link>https://medium.com/@muhammaddendi27/dart-oop-equals-operator-9d97198fdd2d?source=rss-6a7216df2483------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d97198fdd2d</guid>
            <category><![CDATA[oop]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[object-oriented-program]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[dartlang]]></category>
            <dc:creator><![CDATA[dendimuhmd]]></dc:creator>
            <pubDate>Mon, 14 Mar 2022 18:29:58 GMT</pubDate>
            <atom:updated>2022-03-14T18:36:18.316Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>What is the equals operator?</strong></p><p>equals is comparing 2 objects equal or not, usually using operator==</p><p>By default the equals operator belongs to the Object class so in its implementation the equals operator is used to validate that if the class is called many times with the same return value it must be TRUE, because if we manually compare the basic objects in different storage memory then the output that will be generated is false, if not created validation using the equals operator even though the contents are the same.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>Reality cases:</p><p>Sometimes we want to compare objects manually, by default the object may have different memory storage because we can’t control the storage of objects in memory, so if we compare manually the output will produce false even though the contents are the same, so we use the equals operator for logic comparison to return true if we make the contents the same.</p><p>example:</p><p>Manually</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L-bYarW1KAF6VvCZhk57Gw.png" /><figcaption>by default result is gonna be false</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wy0qgn7F-OW8SWtrma9LnA.png" /><figcaption>within equals operator, yah exactly like a magic</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d97198fdd2d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dart OOP-factory method]]></title>
            <link>https://medium.com/@muhammaddendi27/dart-oop-factory-method-eee30f5169b2?source=rss-6a7216df2483------2</link>
            <guid isPermaLink="false">https://medium.com/p/eee30f5169b2</guid>
            <category><![CDATA[oop]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[dart]]></category>
            <dc:creator><![CDATA[dendimuhmd]]></dc:creator>
            <pubDate>Sun, 13 Mar 2022 07:25:40 GMT</pubDate>
            <atom:updated>2022-03-13T12:28:43.362Z</atom:updated>
            <content:encoded><![CDATA[<p>What this factory?</p><p>Factory is a similary method same’s like named parameter constructor method, but it’s a different.</p><p>what this different for 2 method this?</p><p>in named parameter constructor method, u cannot modified value of field on class, now you have one point different about factory and named parameter constructor method</p><p>i’ll to take a screenshot code how to use factory, let see:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ak5CHOP44EDQrPIrWs71iQ.png" /></figure><p>also u can see named constructor parameter:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bFmOsM462IoivWeaDocb2g.png" /></figure><p>let see pict 1, u will see factory always return value.</p><p>you get 2 point.</p><p>yah, i think i just only share some each not a lot, u can see for more at link official at this:</p><p><a href="https://dart.dev/guides/language/language-tour#factory-constructors">A tour of the Dart language</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eee30f5169b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>