<?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 Doni Antoro on Medium]]></title>
        <description><![CDATA[Stories by Doni Antoro on Medium]]></description>
        <link>https://medium.com/@doniantoro34?source=rss-6fb4b1d9b413------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*WDriShE1MF_DFtXUtdHN2g.jpeg</url>
            <title>Stories by Doni Antoro on Medium</title>
            <link>https://medium.com/@doniantoro34?source=rss-6fb4b1d9b413------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 05:29:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@doniantoro34/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[How Testcontainers for Go Changed the Way I Think About Database Migration]]></title>
            <link>https://medium.com/@doniantoro34/how-testcontainers-for-go-changed-the-way-i-think-about-database-migration-c4f519f0d1e6?source=rss-6fb4b1d9b413------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4f519f0d1e6</guid>
            <dc:creator><![CDATA[Doni Antoro]]></dc:creator>
            <pubDate>Fri, 04 Sep 2026 10:24:07 GMT</pubDate>
            <atom:updated>2026-09-04T10:24:07.100Z</atom:updated>
            <content:encoded><![CDATA[<p>Database migration sounds simple when you describe it in one sentence:</p><blockquote><em>“We are migrating from SQL Server to PostgreSQL.”</em></blockquote><p>But once you actually start doing it, you realize that you are not simply moving data from one database to another.</p><p>You are migrating <strong>behavior</strong>.</p><p>And that is where things get complicated.</p><p>Recently, I was involved in a database migration project where an application was being migrated from <strong>SQL Server to PostgreSQL</strong>.</p><p>At first, the development process felt normal.We do step :</p><ul><li>modified queries.</li><li>adjusted syntax.</li><li>fixed data types.</li><li>updated repository implementations.</li><li>ran the application locally.</li><li>performed our self-testing.</li></ul><p>Everything looked good.Until QA found a problem.And that made me realize something:</p><p><strong>Passing development tests does not necessarily mean that the application is ready for production.</strong></p><p>Especially when the database itself has changed.</p><h3><strong>The Problem 1 : SQL Is Not Always Just SQL</strong></h3><p>One of the biggest challenges when migrating from SQL Server to PostgreSQL is that SQL syntax and behavior are not always interchangeable.</p><p>Some queries can simply be rewritten.</p><p>For example, pagination, string manipulation, date functions, type casting, JSON operations, identity columns, and other database-specific features may require different implementations.</p><p>Something that works perfectly in SQL Server may behave differently — or simply fail — in PostgreSQL.</p><p>That means a migration can involve code like this:</p><pre>-- SQL Server<br>SELECT TOP 10 *<br>FROM users<br>ORDER BY created_at DESC;</pre><p>while PostgreSQL might use:</p><pre>SELECT *<br>FROM users<br>ORDER BY created_at DESC<br>LIMIT 10;</pre><p>That example is trivial.The real problems usually aren’t,They tend to appear in queries involving:</p><ul><li>Date and time functions</li><li>String manipulation</li><li>JSON operations</li><li>NULL behavior</li><li>Type casting</li><li>Aggregations</li><li>Pagination</li><li>Identity/sequence behavior</li><li>Database-specific functions</li><li>Stored procedures</li><li>Index behavior</li><li>Transaction behavior</li></ul><p>And sometimes, the query doesn’t fail immediately,It returns a result.But, the result isn’t what the application expects.That is much more dangerous.</p><h3><strong>The Problem 2: “Everything Passed Locally”</strong></h3><p>he migration itself looked straightforward.</p><p>The existing system was using <strong>SQL Server</strong>, and we needed to move it to <strong>PostgreSQL</strong>.</p><p>The general flow was something like:</p><pre>SQL Server<br>    ↓<br>Database schema migration<br>    ↓<br>PostgreSQL<br>    ↓<br>Application</pre><p>From the application side, I needed to make sure that:</p><ul><li>Queries worked correctly</li><li>Data types were compatible</li><li>Repository methods behaved correctly</li><li>Transactions still worked</li><li>Business logic remained unchanged</li><li>Existing tests continued to pass</li></ul><p>So I did what developers normally do.</p><p>I tested the application locally.</p><p>I ran the unit tests.</p><p>And everything passed.</p><pre>Local Development<br>        │<br>        ├── Manual Testing ✅<br>        │<br>        ├── Unit Tests ✅<br>        │<br>        └── Application Flow ✅</pre><p>At this point, it was tempting to conclude:</p><blockquote><em>“The migration is safe.”</em></blockquote><p>But there was one important problem.</p><p><strong>My tests were not running against the same kind of database that would be used in the testing environment.</strong></p><p>And that distinction turned out to matter.</p><h3>Then QA Found What I Missed</h3><p>When the application was deployed to the testing environment, QA started testing the actual flow.</p><p>And eventually:</p><p><strong>An error appeared.</strong></p><p>It wasn’t something I had covered in my local test scenarios.</p><p>The frustrating part wasn’t simply that there was a bug.</p><p>The frustrating part was that:</p><blockquote><strong><em>All my tests had passed.</em></strong></blockquote><p>That forced me to ask a more uncomfortable question.</p><h3>What if QA hadn’t found it?</h3><p>The next environment would be production.</p><p>And if the same problem existed there, the consequences could be much worse.</p><p>A production database problem isn’t just a failed test.</p><p>It can mean:</p><ul><li>Failed transactions</li><li>Incorrect data</li><li>Broken business flows</li><li>Unexpected downtime</li><li>Emergency hotfixes</li><li>Data inconsistencies</li><li>Customer impact</li><li>And potentially a very stressful incident for the engineering team</li></ul><p>The fact that we discovered the problem in testing was actually a good thing.</p><p>But it also exposed something important about my testing strategy.</p><h3>The Realization: I Needed the Real Database</h3><p>After investigating the problem, I realized that what I really wanted was something different from a traditional unit test.</p><p>I wanted to test my application code against:</p><ul><li><strong>A real PostgreSQL database.</strong></li><li>Not a mock.</li><li>Not an in-memory abstraction.</li><li>Not a manually configured development database.</li></ul><p>An actual PostgreSQL instance with the same schema structure that the application would use.</p><p>Ideally, the test should look like this:</p><pre>Go Test<br>   │<br>   ▼<br>Start PostgreSQL Container<br>   │<br>   ▼<br>Import Database Schema<br>   │<br>   ▼<br>Run Application Function<br>   │<br>   ▼<br>Execute Real SQL<br>   │<br>   ▼<br>PostgreSQL<br>   │<br>   ▼<br>Validate Result</pre><p>And after the test:</p><pre>Test Finished<br>     ↓<br>Container Destroyed</pre><p>That’s when I found <a href="https://golang.testcontainers.org/"><strong>Testcontainers for Go</strong>.</a></p><p>Testcontainers is a library that allows tests to programmatically create and manage containers.</p><p>For Go applications, there is a dedicated implementation:</p><p><a href="https://golang.testcontainers.org/?utm_source=chatgpt.com">Testcontainers for Go Documentation</a></p><p>The concept is surprisingly simple.</p><p>Instead of asking:</p><blockquote><em>“Can my repository work with a mocked database?”</em></blockquote><p>we can ask:</p><blockquote><em>“Can my repository actually work with PostgreSQL?”</em></blockquote><p>And we can answer that question automatically during the test.</p><p>For example, conceptually:</p><pre>Test starts<br>    ↓<br>Create PostgreSQL container<br>    ↓<br>Wait until PostgreSQL is ready<br>    ↓<br>Create/import schema<br>    ↓<br>Create database connection<br>    ↓<br>Execute application function<br>    ↓<br>Assert result<br>    ↓<br>Destroy container</pre><p>The important part is that the SQL is actually executed by PostgreSQL.Consider a simple repository query:</p><pre>SELECT *<br>FROM customers<br>WHERE account_number = $1;</pre><p>A mocked unit test might verify that:</p><pre>Expected SQL + Expected parameters= Expected response</pre><p>That’s useful for testing our application’s behavior.</p><p>But it doesn’t necessarily prove that PostgreSQL accepts and executes the query exactly as expected.</p><p>With Testcontainers:</p><pre>Go Repository<br>      ↓<br>database/sql / GORM<br>      ↓<br>PostgreSQL Driver<br>      ↓<br>Real PostgreSQL<br>      ↓<br>Real Schema<br>      ↓<br>Real Query</pre><p>Now we’re testing much closer to reality.</p><p>This means the test can potentially catch problems involving:</p><ul><li>PostgreSQL-specific SQL behavior</li><li>Incorrect column types</li><li>Missing constraints</li><li>Incorrect schema definitions</li><li>Invalid indexes</li><li>Transaction behavior</li><li>PostgreSQL-specific functions</li><li>Differences between SQL Server and PostgreSQL</li></ul><p>And that’s exactly what I needed for a database migration.</p><h3>Unit Test vs Integration Test</h3><p>I now think about these tests differently.</p><p>Test TypeDatabasePurposeUnit TestMockTest business logic and isolated behaviorIntegration TestReal PostgreSQLTest database/application integrationE2E TestReal infrastructureTest complete business flows</p><p>Each one answers a different question.</p><p><strong>Unit test asks:</strong></p><blockquote><em>“Is my code logic correct?”</em></blockquote><p><strong>Integration test asks:</strong></p><blockquote><em>“Does my code actually work with PostgreSQL?”</em></blockquote><p><strong>E2E test asks:</strong></p><blockquote><em>“Does the entire system work from beginning to end?”</em></blockquote><p>These questions are not interchangeable.</p><h3>From “It Works on My Machine” to “It Works With PostgreSQL”</h3><p>The biggest improvement in my testing strategy was a simple shift in mindset.</p><p>Before:</p><pre>&quot;My repository tests are passing.&quot;</pre><p>After:</p><pre>&quot;My repository tests are passing,<br>and my repository also works against<br>a real PostgreSQL database with the actual schema.&quot;</pre><p>The second statement gives me much more confidence. Not absolute confidence.</p><p>Nothing can provide that.</p><p>But significantly better confidence.</p><h3>Final Thoughts</h3><p>That unexpected QA bug was actually a valuable lesson.</p><p>If QA hadn’t caught it, the same issue could potentially have reached production.</p><p>And production is a terrible place to discover that your database migration isn’t fully compatible.</p><p>The experience taught me that <strong>unit tests and integration tests are not competitors</strong>.</p><p>They solve different problems.</p><p>For application logic:</p><p><strong>Use unit tests.</strong></p><p>For database integration:</p><p><strong>Use real databases.</strong></p><p>And when you need a disposable, reproducible, automated database environment:</p><p><strong>Testcontainers is a very practical solution.</strong></p><p>For Go developers, the Testcontainers documentation is available here:</p><p><a href="https://golang.testcontainers.org/?utm_source=chatgpt.com">Testcontainers for Go</a></p><p>My takeaway is simple:</p><blockquote><strong><em>Don’t only test whether your code works. Test whether your code works with the infrastructure it depends on.</em></strong></blockquote><p>Because sometimes, the thing that breaks isn’t your code.</p><p>It’s the assumption that the environment behaves the same way as your mock.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4f519f0d1e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Prevent Race Conditions in Database]]></title>
            <link>https://medium.com/@doniantoro34/how-to-prevent-race-conditions-in-database-3aac965bf47b?source=rss-6fb4b1d9b413------2</link>
            <guid isPermaLink="false">https://medium.com/p/3aac965bf47b</guid>
            <dc:creator><![CDATA[Doni Antoro]]></dc:creator>
            <pubDate>Thu, 27 Jul 2023 06:33:33 GMT</pubDate>
            <atom:updated>2023-07-27T06:33:33.161Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*0P_8IXv53fYLQHXQcJhCGg.jpeg" /></figure><p>Race condition is a condition that occurs when the system attempts to perform two or more operations at the same time and causes problems in the system. In this article, we gonna discuss race conditions in database.</p><p>In this case, we will gonna use airline booking apps as a study case. In an airline booking app system that run on the background is like above , the system will check stock first, if stock is not zero ,then insert booking detail into the order table. After that, update stock in stock table . Then, give response to the customer</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*3PBxxI6JZqNsvhPY2GLVeQ.png" /></figure><p>If only 1 customer at a time that’s actually no matter with the system. But, how about there is more than 1 customer at a time like the image below? ya, it will be a race condition. let&#39;s say the remaining stock is 1. But there is 3 request in a time. the system selects the remaining stock from the database in a table&#39;s stock 3 times a time .because the stock is 1, So the response from table stock will be 1. Because the request is 1, the system will insert it from the order table, then update stock in table stock.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*I6xHMWi4mU1cvwGvLgx7kw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/373/1*YF-6qig32JfPlrNwlRryJA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*HquJ1SAShxK9kj1Hx4lRAg.png" /></figure><p>Is that normal? In the airline business, a seat that avails is 1, then there is 3 order, and it will be chaos. Of course, that’s not normal. So, How to prevent it? Yes, We can use database transactions and locking.</p><p>The schema of using database transactions and locking is when there is much of request on a time, 1 request will be processed in the locking statement, then another request will wait first after there is statement rollback or commit</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*HquJ1SAShxK9kj1Hx4lRAg.png" /></figure><pre>DB::Transaction<br>Select Stock (with locking)<br>if error <br>  DB::Rollback<br>Insert Order <br>if error <br>  DB::RollBack<br>Update Stock <br>if error <br>  DB:: Rollback<br>DB::Commit</pre><p>To implement a locking table, a user can execute the following SQL statement “For Update”. This statement allows a user to lock the rows of a table that are being accessed and prevents other users from updating or locking those rows until the lock is released. To release the lock, the user can commit or roll back the transaction:</p><blockquote>COMMIT; — releases the lock <br>ROLLBACK; — releases the lock and discards any changes made to the data</blockquote><p>Implementation of db transaction and locking will be discussed <a href="https://medium.com/p/2b5aa1508230/">here</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3aac965bf47b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mock json response in microservice using Mockoon]]></title>
            <link>https://medium.com/@doniantoro34/mock-json-response-in-microservice-using-mockoon-e96a0722f180?source=rss-6fb4b1d9b413------2</link>
            <guid isPermaLink="false">https://medium.com/p/e96a0722f180</guid>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[mocking]]></category>
            <category><![CDATA[mockoon]]></category>
            <category><![CDATA[json-api]]></category>
            <category><![CDATA[mockito]]></category>
            <dc:creator><![CDATA[Doni Antoro]]></dc:creator>
            <pubDate>Sat, 03 Dec 2022 04:49:01 GMT</pubDate>
            <atom:updated>2022-12-03T04:49:01.244Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/669/0*PTP4RHf6cpK80BC2.png" /></figure><p>microservice architecture — is an architectural style that structures an application as a collection of services . Actually , we can call a service if we create that service we developed by ourself . What if each service developed by team ,it’s mean every service developed with other people that need to match with the structure ?</p><p>There could be dozens of different reasons but believe me, Mockoon will be your best friend if you are a developer.</p><p>Just press <strong>start</strong> and you can get data that you really require</p><h3>Starting get response with mockoon</h3><p>mockoon can be got <a href="https://mockoon.com/download/">here</a> .After downloading and installing <a href="https://mockoon.com/">Mockoon</a> you will need to press “Play” ▶️ button (Start server) and your local server is fully functional and ready to be “requested”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5RftZlTjFq0M7IyN28bl2w.png" /></figure><p>Explanation :</p><ol><li>button to add environment : you can add more than environment, for example you have 3–5 service , you can add environment with different port.</li><li>List of environment that you made : there is name and url+port , the example 0.0.0.0:3000 , it means mock can run on localhost:3000 or <a href="http://127.0.0.1:3000/">http://127.0.0.1:3000/</a></li><li>list of api/response for mocking. every environment maybe has more than 1 api/mock needed , so you can add mock and see list here</li><li>method of mocking : not only get,there is some response provided http methods. you can change methods than you want with same methods in service that you will call</li><li>endpoint : you can create endpoint that you want same as service that you will call</li><li>Response of mocking : when developed endpoint , there is some scenario like success, failed because unauthorization , bad request ,etc. Moockon provide multiple response that you want , and choose which response that you want</li><li>Rules &amp; reponse : in each response that you made in point 6 , you add response body &amp; header that you want , you can also add scenario in response you made, like if there is not payload or there is no header in bar Rules</li><li>Response Http : not only success response code (200),there is some response provided http . you can change response code than you want for each response mocking (point.6)</li><li>Response body : we can create response body that we want same as other service build</li><li>button to run : click this button to run moockon , and try to hit endpoint in postman</li></ol><h3>Start Create mock</h3><p>as explanation , mockoon can add some rules. now we can create with rules that must have header, in this case header must be Autorization.First of all , we need 2 Scenario that success &amp; Unauthorized scenario , for success scenario will return like this</p><pre>{<br>  &quot;status&quot; : 200,<br>  &quot;message&quot; : &quot;Success&quot;,<br>  &quot;data&quot;: {<br>    &quot;nama&quot; : &quot;Doni Antoro&quot;,<br>    &quot;job&quot; : &quot;Back-end Developer             &quot;<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*l9TlQyVqsr4AO0qIsTUfIQ.png" /></figure><p>After That we must create Unauthorized response with status code 401 .to create response Authorized we must create rules first, the rules you can get on Rules tab , add add the rules in case , i will make te rules the header key must be Authorization and the value is “Bearer eyzdx”, and dont forget click “!” between Key and value header , it’s mean not equals. the return will be set like this</p><pre>{<br>&quot;status&quot; : 401,<br>&quot;message&quot; : &quot;Unauthorized&quot;,<br>&quot;data&quot;: null<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K8TEgAiyFD2dmij3zljHsQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*LOtNyNX3tm_tpXfpGLTNeA.png" /></figure><p><strong>NOTES</strong></p><ol><li>Mockoon can use when endpoint that wanna consumed still developed phase ,or when endpoint can’t access (endpoint can access ,but need vpn or other)</li><li>Mockoon can save your device resource because we needn’t run much service (when using microservice)</li><li>Mockoon can also used by front-end because using json response , it can use same as consumed real api</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e96a0722f180" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter : Push Notification]]></title>
            <link>https://medium.com/@doniantoro34/flutter-push-notification-a3d36595c991?source=rss-6fb4b1d9b413------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3d36595c991</guid>
            <dc:creator><![CDATA[Doni Antoro]]></dc:creator>
            <pubDate>Wed, 21 Jul 2021 12:20:18 GMT</pubDate>
            <atom:updated>2021-07-22T07:21:18.902Z</atom:updated>
            <content:encoded><![CDATA[<h3>Flutter : Push Notification</h3><p><em>By : Doni Antoro &amp; Ningsih Adityas</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UxzfLNF6cltE9i86AXZ_PA.png" /></figure><p>Google cloud Messaging provides you to make notification in your apps for driving user engagement and notifying users for updates.It allows you to send notifications to a customised group of users on a variety of platforms easily.</p><p>let’s get started.</p><h3>Creating a Firebase project</h3><p>We will need to create a new Firebase project in order to integrate it with our application.</p><p>Navigate to the <a href="https://console.firebase.google.com/">Firebase console</a> and click <strong>Add project</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NVcudLgaxt95vzUFY9bSUQ.png" /></figure><p>Enter a project name and click <strong>Continue</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*CMBU9KjQhQerALlSU506QA.png" /></figure><p>Wait for the project to be created, and you’ll be navigated to the project’s Firebase dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*duTNr4GLud6CJrFt.png" /></figure><h3>Integrating Firebase with Platfoam based</h3><ul><li>Choose platfoam which we want to create IOS,Android or website.Here,we use Android</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*WCCK3LK5EkzC3o9B.png" /></figure><ul><li>Then,Enter the package name, an app nickname(Optional), and the SHA-1(Optional). Click on <strong>Register app</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*eQGkt9eI3m3ETWD0y84LqQ.png" /></figure><ul><li>Download the google-services.json file and place it in the <strong>android → app</strong> directory. Click on <strong>Next</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/262/1*GEjEgwlXVEo8Z2Jh8EOj7w.png" /></figure><ul><li>Then,Just follow the instructions provided, and add the required code snippets to our project on file &lt;root&gt;/build.gradle and &lt;root&gt;/&lt;app-module&gt;/build.gradle. Click on <strong>Next</strong>.</li><li>Set up dependencies in project level build.gradle file</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bccbb61a6313173c765be3b6bbbf0a99/href">https://medium.com/media/bccbb61a6313173c765be3b6bbbf0a99/href</a></iframe><ul><li>Set up dependencies in project app-level build.gradle file</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f68d07746a126edf4171a50b5cb3d62c/href">https://medium.com/media/f68d07746a126edf4171a50b5cb3d62c/href</a></iframe><h3>Integrate Firebase Messaging with Flutter</h3><pre>firebase_core: ^1.4.0<br>firebase_messaging: ^10.0.4<br>flutter_local_notifications:</pre><blockquote>The <strong>firebase_core</strong> plugin is responsible for connecting Flutter app to Firebase project.</blockquote><blockquote>flutter_local_notifications is a plugin to use local notification</blockquote><blockquote>firebase_messaging is a plugin to use the Firebase Cloud Messaging</blockquote><ul><li>Run the flutter pub get to set the dependencies</li><li>Import all package needed</li></ul><blockquote>import ‘package:flutter/material.dart’;<br>import ‘package:firebase_core/firebase_core.dart’;<br>import ‘package:firebase_messaging/firebase_messaging.dart’;<br>import ‘package:flutter_local_notifications/flutter_local_notifications.dart’;</blockquote><ul><li>Next up, We will initialize Firebase into our App, this is done through the firebase core plugin, we need this to use any service from firebase such as fcm, database, and restore and the rest of them as well.It needs to be written in an asynchronous method to make sure the firebase initialized properly</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a181e7c04e7c52cdbee6d9efbf2199e7/href">https://medium.com/media/a181e7c04e7c52cdbee6d9efbf2199e7/href</a></iframe><ul><li>Initialize Notification Channel<br>This channel will help in receiving notification in android. The function of this channel will be seen when have multiple notification in application.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0eb156445bd1a888870852f20d4ea418/href">https://medium.com/media/0eb156445bd1a888870852f20d4ea418/href</a></iframe><ul><li>Initialize Local Notification Plug in<br>Make it globally with write on the top</li></ul><blockquote>Final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =FlutterLocalNotificationsPlugin();</blockquote><p>This is a simple example of local notification function that will triggered when we click the button</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/33cbe5d8c70df354d353f2fd8ae77636/href">https://medium.com/media/33cbe5d8c70df354d353f2fd8ae77636/href</a></iframe><p>So, this is how its going to look</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*8LC0Ui-4yL8A2jDW_dRG_g.png" /></figure><p>When receiving messages the further behavior depends on whether the app is running in the foreground, the background or not at all.</p><h3><strong>Handling Message in Foreground</strong></h3><p>add these lines in main method to Handling Message in Foreground, Add these lines in main function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/002b086ec5e5d20c094b13b82bfc3938/href">https://medium.com/media/002b086ec5e5d20c094b13b82bfc3938/href</a></iframe><p>This is how notification in the foreground are displayed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*EjsBcpsqA940b1aVp54uBg.png" /></figure><h3><strong>Handling Message in Background</strong></h3><p>In handling message in background, first we need to initialize the background notification handler method. Whenever a background notificatiosn shows up this function will initialize the firebase app</p><blockquote>Future&lt;void&gt; _firebaseMessagingBackgroundHandler(RemoteMessage message async {</blockquote><blockquote>await Firebase.initializeApp();</blockquote><blockquote>print(‘background message ${message.notification!.body}’);</blockquote><blockquote>}</blockquote><p>Then we need to write this line inside the main function</p><blockquote>FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);</blockquote><p>it will be called when we receive a background notification. This is how notification looks like in background</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*HPGQXicDwrb7fvotFDTwPA.png" /></figure><p>we can also add a dialog box that will show the information of the massage when we click on notification and open the app from terminated or background state,</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/aa7d7c6c0f533b1277471f231424f172/href">https://medium.com/media/aa7d7c6c0f533b1277471f231424f172/href</a></iframe><p>this will be displayed as below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/376/1*A1KOWzP9XTQvvrGuFQ8OBg.png" /></figure><p>This is full code of push notification</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ee730db1787f1067d317ef2d8a2734d5/href">https://medium.com/media/ee730db1787f1067d317ef2d8a2734d5/href</a></iframe><h3><strong>sending notification from firebase console</strong></h3><p>with this feature,we can make schedule when notification sent,and who will get notification.To send the message from firebase console Select the <em>“Cloud Messaging”</em> in the “Engage Menu”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*ATNC1FmqbxOmQoFg-BldGA.png" /></figure><p>Then, click add new notification. Enter the notification title and notification text. Click Next</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*k8YXPKjrF45qtr_yHXLkjg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*sVlNxSWaWm8ODFCFcgpdvA.png" /></figure><p>Select the target user (the applicationId that we registered in the beginning).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*kO-0g7lS6fqX5xSW22j1tg.png" /></figure><p>Notifications can be sent directly or scheduled with a custom date. Then click the “review” button. Finally notification will be received on the client application.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3d36595c991" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tutorial Laravel #1 : Install Laravel]]></title>
            <link>https://medium.com/@doniantoro34/tutorial-laravel-1-install-laravel-2c3004060e71?source=rss-6fb4b1d9b413------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c3004060e71</guid>
            <category><![CDATA[install-laravel]]></category>
            <category><![CDATA[laravel-framework]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[php-framework-laravel]]></category>
            <dc:creator><![CDATA[Doni Antoro]]></dc:creator>
            <pubDate>Thu, 13 Feb 2020 17:26:54 GMT</pubDate>
            <atom:updated>2020-02-13T18:41:47.534Z</atom:updated>
            <content:encoded><![CDATA[<h3>Tutorial Laravel #1 : Install Laravel</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*snHJpgEnGCPzD-ck.jpg" /></figure><p>Laravel adalah sebuah Framewok PHP yang sedang booming akhir-akhir ini. Laravel dibuat untuk mempermudah para developer dalam membangun sebuah website dengan skala kecil-besar,jika kita lihat di website pencarian kerja ,lowongan untuk laravel cukup banyak.</p><p>Laravel menggunakan metode MVC (Model, view , Controller). So, apa sih MVC ? MVC merupakan suatu metode untuk bagian-bagian website.<br>-Model : Model adalah istilah yang digunakan untuk database<br>-View : View adalah istilah untuk tampilan sebuah website tersebut<br>-Controller : Controller adalah bagian yang menanggani dan mengatur antara mode dan view</p><p>Jika teman-teman masih binggung,mending langsung install dan praktek</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vjmSIYnZFJvbH7jI.jpg" /></figure><h3><strong>Cara Install Laravel</strong></h3><p>Sebelum kita install laravel,kita harus mendownload composer</p><ul><li>Untuk pengguna windows :<br>bisa langsung <a href="https://getcomposer.org/Composer-Setup.exe"><em>klik link</em></a> berikut,lalu install seperti install aplikasi pada umum nya</li><li>Pengguna linux/mac os : <br>Silakan teman-teman buka terminal,kemudia ketik/copas perintah berikut</li></ul><pre>php -r “copy(‘https://getcomposer.org/installer&#39;, ‘composer-setup.php’);”</pre><pre>php -r “if (hash_file(‘sha384’, ‘composer-setup.php’) === ‘93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8’) { echo ‘Installer verified’; } else { echo ‘Installer corrupt’; unlink(‘composer-setup.php’); } echo PHP_EOL;”</pre><pre>php composer-setup.php</pre><pre>php -r “unlink(‘composer-setup.php’);”</pre><p>kemudian ketik perintah berikut agar composer bisa digunakan melalui terminal</p><blockquote>mv composer.phar /usr/local/bin/composer</blockquote><p>teman-teman juga bisa langung mengunjungi <a href="https://getcomposer.org/"><em>website composer</em></a> untuk lebih jelas nya</p><p>Selanjutnya kita langsung memulai instalasi laravel dengan menggunakan composer . teman-teman bisa langung masuk kedalam directory yang teman-teman kehendaki,lalu ketikan perintah berikut untuk install laravel</p><blockquote>composer create-project — prefer-dist laravel/laravel tutorial_laravel</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*PqvxUm-qVAzfoUCxw_AsEg.png" /></figure><p>Pada contoh tutorial laravel ini kita akan membuat project laravel dengan nama <em>tutorial_laravel .</em>nama project bisa diganti sesuai nama yang teman-teman kehendaki,namun alangkah baik nya ikuti seri tutorial ini.</p><p>setelah kita selesai install project laravel nya,sekarang kita sudah punya folder project laravel dengan nama <em>tutorial_laravel .</em>jadi kita masuk kedalam folder project yang sudah kita buat</p><blockquote><em>cd tutorial_laravel</em></blockquote><p>dan kita jalankan project laravel nya,dengan mengetik</p><blockquote>php artisan serve</blockquote><p>kemudian buka browser teman-teman,lalu buka url berikut</p><blockquote><a href="http://127.0.0.1:8000/">http://127.0.0.1:8000</a></blockquote><p>jika semua sudah berhasil,maka akan tampil seperti ini</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QB7bVPNTLTzl88MP.png" /></figure><p>SELAMAT !!!! instalasi laravel telah selesai .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c3004060e71" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>