<?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 Kaung Khant Htun on Medium]]></title>
        <description><![CDATA[Stories by Kaung Khant Htun on Medium]]></description>
        <link>https://medium.com/@kaungkhanthtun?source=rss-6692d6d6ba0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*NQwQkl8Grb_GhOjerOwWlw.png</url>
            <title>Stories by Kaung Khant Htun on Medium</title>
            <link>https://medium.com/@kaungkhanthtun?source=rss-6692d6d6ba0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 12:57:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kaungkhanthtun/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 to create a Flutter dynamic content book app with Google Sheet]]></title>
            <link>https://medium.com/@kaungkhanthtun/how-to-create-a-flutter-dynamic-content-book-app-with-google-sheet-a789cf64bc51?source=rss-6692d6d6ba0------2</link>
            <guid isPermaLink="false">https://medium.com/p/a789cf64bc51</guid>
            <category><![CDATA[offline-mode]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[book-app]]></category>
            <category><![CDATA[google-sheets-api]]></category>
            <category><![CDATA[isar-database]]></category>
            <dc:creator><![CDATA[Kaung Khant Htun]]></dc:creator>
            <pubDate>Wed, 17 Apr 2024 07:02:14 GMT</pubDate>
            <atom:updated>2024-04-17T07:06:16.342Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to create a Flutter dynamic content book app with Google Sheets</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IH7XF2LF7G_HJ4SSLU1esw.png" /></figure><p>In today’s mobile app development landscape, there are various options for backend infrastructure, including traditional backend servers, Firebase, and even unconventional solutions like Google Sheets. While Google Sheets may not be the conventional choice for backend storage, it offers simplicity and flexibility for certain types of applications.</p><h4><strong>Why did I choose Google Sheets instead of Firebase?</strong></h4><ol><li><strong><em>Pricing and Free Usage Limits</em></strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*npjAulM1m0rGjx1sbw8-2g.png" /><figcaption>Firebase Could Firestore</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gf9DYqokwoeEBkh_xZlAVQ.png" /><figcaption>Google Sheet API</figcaption></figure><p>For free usage, Firebase can use maximum read requests of up to 50K and 20K write requests per day. In Google Sheets, 300 read requests and 300 write requests per minute.</p><p><strong><em>2. Easy to update contents</em></strong></p><p>Google Sheets provides a user-friendly interface that allows users to edit app content directly from their mobile devices. This eliminates the need for complex backend dashboards or computer access.</p><h4><strong>Implementing Google Sheets in Your Mobile App</strong></h4><ul><li><strong><em>Authentication</em></strong>: Ensure that only authorized users have access to your Google Sheets data. You can use OAuth 2.0 authentication to authenticate users and obtain access tokens for making API requests.</li><li><strong><em>Data Synchronization</em></strong>: Implement mechanisms to sync data between your mobile app and Google Sheets. This may involve periodic data updates, real-time synchronization using webhooks, or manual triggers initiated by users.</li><li><strong><em>Error Handling</em></strong>: Handle potential errors gracefully, such as network failures or API rate limits. Implement retry mechanisms and error logging to ensure the smooth operation of your app.</li></ul><p>I used <a href="https://pub.dev/packages/gsheets"><strong>https://pub.dev/packages/gsheets</strong></a> to integrate with Google Sheets in my Flutter Book app.</p><blockquote><strong><em>To Get Credentials for Google Sheets — </em></strong><a href="https://medium.com/@a.marenkov/how-to-get-credentials-for-google-sheets-456b7e88c430">https://medium.com/@a.marenkov/how-to-get-credentials-for-google-sheets-456b7e88c430</a></blockquote><blockquote><strong><em>Dart: Working With Google Sheets </em>—</strong> <a href="https://itnext.io/dart-working-with-google-sheets-793ed322daa0">https://itnext.io/dart-working-with-google-sheets-793ed322daa0</a></blockquote><p><strong>Example of Google Sheets Service</strong></p><pre>const _credentials = r&#39;&#39;&#39;<br>{<br>  &quot;type&quot;: &quot;###&quot;,<br>  &quot;project_id&quot;: &quot;###&quot;,<br>  &quot;private_key_id&quot;: &quot;###&quot;,<br>  &quot;private_key&quot;: &quot;###&quot;,<br>  &quot;client_email&quot;: &quot;###&quot;,<br>  &quot;client_id&quot;: &quot;###&quot;,<br>  &quot;auth_uri&quot;: &quot;https://accounts.google.com/o/oauth2/auth&quot;,<br>  &quot;token_uri&quot;: &quot;https://oauth2.googleapis.com/token&quot;,<br>  &quot;auth_provider_x509_cert_url&quot;: &quot;https://www.googleapis.com/oauth2/v1/certs&quot;,<br>  &quot;client_x509_cert_url&quot;: &quot;###&quot;<br>}<br>&#39;&#39;&#39;;<br><br>const _spreadsheetId = &#39;###&#39;;<br><br>Logger log = Logger();<br><br>class GSServie {<br>  init() async {<br>    final Connectivity connectivity = Connectivity();<br>    try {<br>      ConnectivityResult result = await connectivity.checkConnectivity();<br>      if (result == ConnectivityResult.none) return;<br>    } on PlatformException catch (e) {<br>      debugPrint(&#39;Couldn\&#39;t check connectivity status&#39;);<br>      return;<br>    }<br>    final gsheets = GSheets(_credentials);<br>    final ss = await gsheets.spreadsheet(_spreadsheetId);<br>    Get.put(ss);<br>  }<br>}</pre><h4>Implementing Offline mode</h4><p>For the local DB, I used <a href="https://isar.dev/">Isar Database</a> that is a fast and user-friendly NoSQL database designed for Flutter. It is known for its simple API, cross-platform support, and low disk usage. Isar offers various features such as automatic JSON serialization/deserialization, optional encryption, and the ability to perform complex queries. The best thing is the <strong>Isar Database Inspector</strong> which allows you to inspect the Isar instances &amp; collections of your app in real time. You can execute queries, edit properties, switch between instances, and sort the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t-xQf-npNYDrChqNQ_qhmw.png" /></figure><p>In my spreadsheet, I have 3 main parts:</p><ol><li><strong>Books</strong>: Books Information</li><li><strong>Episodes</strong>: Episodes of the books link with book id</li><li><strong>Content Version</strong>: content version number to check and fetch up-to-date content from the mobile app</li></ol><p><strong>Fetching Data From Google Sheet:</strong></p><pre>fetchData() async {<br>    final Connectivity _connectivity = Connectivity();<br>    try {<br>      ConnectivityResult result = await _connectivity.checkConnectivity();<br>      if (result == ConnectivityResult.none) return;<br>    } on PlatformException catch (e) {<br>      debugPrint(&#39;Couldn\&#39;t check connectivity status&#39;);<br>      return;<br>    }<br><br>    final prefs = await SharedPreferences.getInstance();<br><br>    Worksheet contentSheet =<br>        Get.find&lt;Spreadsheet&gt;().worksheetByTitle(&#39;contents&#39;)!;<br>    prefs.setString(<br>        &quot;setting_content&quot;, await contentSheet.values.value(column: 1, row: 2));<br>    Worksheet contentVersionSheet =<br>        Get.find&lt;Spreadsheet&gt;().worksheetByTitle(&#39;versions&#39;)!;<br>    final latestContentVersion =<br>        int.parse(await contentVersionSheet.values.value(column: 1, row: 2));<br>    final currentContentVersion = prefs.getInt(&quot;content_versions&quot;);<br>    if (currentContentVersion == null ||<br>        currentContentVersion &lt; latestContentVersion) {<br>      Worksheet bookSheet = Get.find&lt;Spreadsheet&gt;().worksheetByTitle(&#39;books&#39;)!;<br>      Worksheet episodeSheet =<br>          Get.find&lt;Spreadsheet&gt;().worksheetByTitle(&#39;episodes&#39;)!;<br><br>      var bookRow = await bookSheet.values.allRows(fromRow: 2);<br>      var episodeRow = await episodeSheet.values.allRows(fromRow: 2);<br><br>      List&lt;Book&gt; books = bookRow.map((e) =&gt; Book.fromSheet(e)).toList();<br>      for (Book book in books) {<br>        await saveBook(book);<br>      }<br><br>      List&lt;Episode&gt; episodes =<br>          episodeRow.map((e) =&gt; Episode.fromSheet(e)).toList();<br>      for (Episode episode in episodes) {<br>        await saveEpisode(episode);<br>      }<br><br>      await prefs.setInt(&quot;content_versions&quot;, latestContentVersion);<br>    }</pre><p>Before fetching books and episode data, check the content_version. If local content is outdated, fetch the data and save it to the Isar Database.</p><p>I will skip all of the functionality, these depend on your base project idea.</p><p>Here is my final result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x1k0ZSBNVi6m985qDIIM8A.png" /></figure><p><strong><em>Thank you for reading until the end.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a789cf64bc51" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>