<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Curtly Critchlow</title>
    <description>The latest articles on Forem by Curtly Critchlow (@curtlycritchlow).</description>
    <link>https://forem.com/curtlycritchlow</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F630314%2F8dd6e50c-8738-42a6-a910-6733e29104bd.jpg</url>
      <title>Forem: Curtly Critchlow</title>
      <link>https://forem.com/curtlycritchlow</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/curtlycritchlow"/>
    <language>en</language>
    <item>
      <title>A Step-by-Step Guide to Internationalizing Flutter App</title>
      <dc:creator>Curtly Critchlow</dc:creator>
      <pubDate>Sat, 07 Sep 2024 00:11:22 +0000</pubDate>
      <link>https://forem.com/curtlycritchlow/a-step-by-step-guide-to-internationalizing-flutter-app-457e</link>
      <guid>https://forem.com/curtlycritchlow/a-step-by-step-guide-to-internationalizing-flutter-app-457e</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Welcome to this comprehensive tutorial where we will delve into the key steps required to internationalize your Flutter app. We'll focus on the essentials and provide you with a clear understanding of the process. For more detailed explanations and advanced use cases, you can refer to our &lt;a href="https://docs.flutter.dev/accessibility-and-localization/internationalization#introduction-to-localizations-in-flutter" rel="noopener noreferrer"&gt;recommended resource&lt;/a&gt; on Internationalizing Flutter apps.&lt;/p&gt;

&lt;h3&gt;
  
  
  Configuration settings
&lt;/h3&gt;

&lt;p&gt;To get started, follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Create your Flutter project and execute the following code to download the required packages:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;flutter pub add flutter_localizations &lt;span class="nt"&gt;--sdk&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;flutter
flutter pub add intl:any
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In your &lt;code&gt;pubspec.yaml&lt;/code&gt; file, add the following code under the Flutter section:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# The following section &lt;/span&gt;
&lt;span class="s"&gt;is specific to Flutter.&lt;/span&gt;
&lt;span class="na"&gt;flutter&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;generate&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="c1"&gt;# Add this line&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a &lt;code&gt;l10n.yaml&lt;/code&gt; file in the root folder of your project:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;l10n.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open the &lt;code&gt;l10n.yaml&lt;/code&gt; file and add the following content:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;arb-dir&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;lib/l10n&lt;/span&gt;
&lt;span class="na"&gt;template-arb-file&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app_en.arb&lt;/span&gt;
&lt;span class="na"&gt;output-localization-file&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app_localizations.dart&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* Specify the `arb-dir` parameter with the folder path where your    `.arb` file will be stored.

* Set the `template-arb-file` parameter with the name of your .arb file. The naming convention is `app_&amp;lt;language_code&amp;gt;.arb` , where `&amp;lt;language_code&amp;gt;` represents the language code (e.g., "en" for English, "es" for Spanish). You can create multiple `.arb` files for different languages you intend to support.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Create the &lt;code&gt;arb&lt;/code&gt; folder and the &lt;code&gt;app_en.arb&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;lib/l10n
&lt;span class="nb"&gt;touch &lt;/span&gt;lib/l10n/app_en.arb
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open &lt;code&gt;lib/l10n/app_en.arb&lt;/code&gt; and add the following content:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"materialAppTitle"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"localizations Sample App'
}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Run the following command to generate the necessary configuration file:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;flutter gen-l10n
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Adding localization to your app
&lt;/h3&gt;

&lt;p&gt;To integrate localization into you app, follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;In &lt;code&gt;main.dart&lt;/code&gt; , import &lt;code&gt;app_localizations.dart&lt;/code&gt; :&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:flutter_gen/gen_l10n/app_localizations.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Within the &lt;code&gt;MaterialApp&lt;/code&gt; widget, add &lt;code&gt;AppLocalizations.localization&lt;/code&gt; as the &lt;code&gt;localizationsDelegates&lt;/code&gt; parameter and &lt;code&gt;AppLocalizations.supportedLocales&lt;/code&gt; as the &lt;code&gt;supportedLocales&lt;/code&gt; parameter:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;MaterialApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="nl"&gt;localizationsDelegates:&lt;/span&gt; &lt;span class="n"&gt;AppLocalizations&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;localizationsDelegates&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;supportedLocales:&lt;/span&gt; &lt;span class="n"&gt;AppLocalizations&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;supportedLocales&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;home:&lt;/span&gt; &lt;span class="n"&gt;Builder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;builder:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;Scaffold&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
          &lt;span class="nl"&gt;body:&lt;/span&gt; &lt;span class="n"&gt;Center&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;child:&lt;/span&gt;    &lt;span class="n"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;AppLocalizations&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;!.&lt;/span&gt;&lt;span class="na"&gt;materialAppTitle&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="p"&gt;}),&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Whenever you update the &lt;code&gt;app_en.arb&lt;/code&gt; file, run &lt;code&gt;flutter gen-l10n&lt;/code&gt; to update it. Alternatively, if you're using Visual Studio Code, right-click on the &lt;code&gt;app_en.arb&lt;/code&gt; file and select "Generate Localizations".&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Run your Flutter app and it should now support localization.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhntn1xxha4529bbx3btg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhntn1xxha4529bbx3btg.png" alt="flutter app showing the localization" width="299" height="589"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Congratulations!, You have successfully added localization to your Flutter app. Make sure to bookmark this tutorial for future reference in your upcoming Flutter projects. By implementing localization, you can reach a wider audience and provide a more personalized experience for your users.&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
    </item>
    <item>
      <title>How to Fix 'AssetManifest' is imported from both 'package:flutter...' and 'package:google_fonts...' error</title>
      <dc:creator>Curtly Critchlow</dc:creator>
      <pubDate>Thu, 11 May 2023 13:38:50 +0000</pubDate>
      <link>https://forem.com/curtlycritchlow/how-to-fix-assetmanifest-is-imported-from-both-packageflutter-and-packagegooglefonts-error-28e8</link>
      <guid>https://forem.com/curtlycritchlow/how-to-fix-assetmanifest-is-imported-from-both-packageflutter-and-packagegooglefonts-error-28e8</guid>
      <description>&lt;h2&gt;
  
  
  Indroduction
&lt;/h2&gt;

&lt;p&gt;In this article I'll share with you how to fix'AssetManifest' is imported from both 'package:flutter/src/services/asset_manifest.dart' and 'package:google_fonts/src/asset_manifest.dart'.&lt;/p&gt;

&lt;p&gt;When you run your flutter app you might notice this error in your debug console.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Launching lib/main.dart on SM A225M in debug mode...
main.dart:1
Warning: Errors limit exceeded. To receive all errors set com.sun.xml.bind logger to FINEST level.
Warning: unexpected element (uri:"", local:"extension-level"). Expected elements are &amp;lt;{}codename&amp;gt;,&amp;lt;{}layoutlib&amp;gt;,&amp;lt;{}api-level&amp;gt;
: Error: 'AssetManifest' is imported from both 'package:flutter/src/services/asset_manifest.dart' and 'package:google_fonts/src/asset_manifest.dart'.
google_fonts_base.dart:14
import 'asset_manifest.dart';
^^^^^^^^^^^^^
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;Fortunately this is a simple fix, update your &lt;code&gt;google_fonts:&lt;/code&gt; package in &lt;code&gt;pubspec.yaml&lt;/code&gt; to the &lt;a href="https://pub.dev/packages/google_fonts"&gt;latest version&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Run your flutter app and your code should be fine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect with me
&lt;/h2&gt;

&lt;p&gt;Thank you for reading my post. Feel free to like, comment, subscribe or connect with me on &lt;a href="https://www.linkedin.com/in/curtlycritchlow/"&gt;LinkedIn&lt;/a&gt; and &lt;a href="https://twitter.com/CritchlowCurtly"&gt;Twitter&lt;/a&gt;. You can also &lt;a href="https://www.buymeacoffee.com/curtlycritchlow"&gt;buy me a book&lt;/a&gt; to show your support.&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
    </item>
    <item>
      <title>How to fix An error occured when accessing the keychain when authenticating with firebase_auth</title>
      <dc:creator>Curtly Critchlow</dc:creator>
      <pubDate>Tue, 25 Apr 2023 23:20:28 +0000</pubDate>
      <link>https://forem.com/curtlycritchlow/how-to-fix-an-error-occured-when-accessing-the-keychain-when-authenticating-with-firebaseauth-2akh</link>
      <guid>https://forem.com/curtlycritchlow/how-to-fix-an-error-occured-when-accessing-the-keychain-when-authenticating-with-firebaseauth-2akh</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this article we'll discuss the fix for &lt;code&gt;An error occured when accessing the keychain. The NSLocalizedFailureReasonErrorKey field in the NSError.userInfo dictionary will contain more information about the above error&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You might see this error when trying to sign in to your flutter app using &lt;code&gt;firebase_auth&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open your macOs folder in Xcode&lt;/li&gt;
&lt;li&gt;In runner, under targets select &lt;code&gt;+ capability&lt;/code&gt; tab&lt;/li&gt;
&lt;li&gt;select &lt;code&gt;keychain sharing&lt;/code&gt; complete the instructions given in Xcode&lt;/li&gt;
&lt;li&gt;restart your project and you will be prompted to enter your keychain password&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's it, You should now be able to authenticate with firebase_auth in your flutter app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect with me
&lt;/h2&gt;

&lt;p&gt;Thank you for reading my post. Feel free to subscribe below or connect with me on &lt;a href="https://www.linkedin.com/in/curtlycritchlow/"&gt;LinkedIn&lt;/a&gt; and &lt;a href="https://twitter.com/CritchlowCurtly"&gt;Twitter&lt;/a&gt;. You can also &lt;a href="https://www.buymeacoffee.com/curtlycritchlow"&gt;buy me a book&lt;/a&gt; to show your support.&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>firebase</category>
      <category>macos</category>
    </item>
    <item>
      <title>How to fix network error (such as timeout, interrupted connection or unreachable host) has occured.</title>
      <dc:creator>Curtly Critchlow</dc:creator>
      <pubDate>Tue, 25 Apr 2023 22:53:02 +0000</pubDate>
      <link>https://forem.com/curtlycritchlow/how-to-fix-network-error-such-as-timeout-interrupted-connection-or-unreachable-host-has-occured-4nhh</link>
      <guid>https://forem.com/curtlycritchlow/how-to-fix-network-error-such-as-timeout-interrupted-connection-or-unreachable-host-has-occured-4nhh</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this article we will show how to fix the &lt;code&gt;network error (such as timeout, interrupted connection or unreachable host) has occured&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;In Xcode, check Incoming connections and outgoing connections in debug, release and profile mode as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bvZaG1Y---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kvkk7ljgmjkilcaqym1u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bvZaG1Y---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kvkk7ljgmjkilcaqym1u.png" alt="Image description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect with me
&lt;/h2&gt;

&lt;p&gt;Thank you for reading my post. Feel free to subscribe below or connect with me on &lt;a href="https://www.linkedin.com/in/curtlycritchlow/"&gt;LinkedIn&lt;/a&gt; and &lt;a href="https://twitter.com/CritchlowCurtly"&gt;Twitter&lt;/a&gt;. You can also &lt;a href="https://www.buymeacoffee.com/curtlycritchlow"&gt;buy me a book&lt;/a&gt; to show your support.&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>macos</category>
    </item>
    <item>
      <title>How to fix core/duplicate-app] A Firebase App named "[DEFAULT]" already exists error</title>
      <dc:creator>Curtly Critchlow</dc:creator>
      <pubDate>Mon, 24 Apr 2023 20:38:48 +0000</pubDate>
      <link>https://forem.com/curtlycritchlow/how-to-fix-coreduplicate-app-a-firebase-app-named-default-already-exists-error-3bjj</link>
      <guid>https://forem.com/curtlycritchlow/how-to-fix-coreduplicate-app-a-firebase-app-named-default-already-exists-error-3bjj</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this article we will cover the fix for [core/duplicate-app] A Firebase App named "[DEFAULT]" already exists exception.&lt;/p&gt;

&lt;p&gt;If you tried running your flutter app that's using a firebase product you might see this error if your &lt;code&gt;GoogleService-Info.plist&lt;/code&gt; or &lt;code&gt;google-services.json&lt;/code&gt; files are outdated.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: [core/duplicate-app] A Firebase App named "[DEFAULT]" already exists
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;To fix the &lt;code&gt;core/duplicate-app] A Firebase App named "[DEFAULT]" already exists&lt;/code&gt; exception follow these two simple steps &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Delete your &lt;code&gt;google-services.json&lt;/code&gt; located at &lt;code&gt;android/app/google-services.json&lt;/code&gt; if running on android or delete your &lt;code&gt;GoogleService-Info.plist&lt;/code&gt; located at&lt;br&gt;
&lt;code&gt;macos/Runner/GoogleService-Info.plist&lt;/code&gt; if running on MacOS or &lt;code&gt;ios/Runner/GoogleService-Info.plist&lt;/code&gt; if running on IOS.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install and Run the flutterFire CLI in the root of your flutter project directory.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If flutterFire CLI not already installed run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ dart pub global activate flutterfire_cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next Run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ flutterfire configure --project=&amp;lt;yourprojectID&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Follow the instructions in your terminal.&lt;/p&gt;

&lt;p&gt;Your flutter project should now run successfully.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect with me
&lt;/h2&gt;

&lt;p&gt;Thank you for reading my post. Feel free to subscribe below or connect with me on &lt;a href="https://www.linkedin.com/in/curtlycritchlow/"&gt;LinkedIn&lt;/a&gt; and &lt;a href="https://twitter.com/CritchlowCurtly"&gt;Twitter&lt;/a&gt;. You can also &lt;a href="https://www.buymeacoffee.com/curtlycritchlow"&gt;buy me a book&lt;/a&gt; to show your support.&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>firebase</category>
      <category>ios</category>
      <category>macos</category>
    </item>
    <item>
      <title>How to fix java.security.NoSuchAlgorithmException: Algorithm HmacPBESHA256 not available when building app bundle</title>
      <dc:creator>Curtly Critchlow</dc:creator>
      <pubDate>Wed, 05 Apr 2023 13:44:09 +0000</pubDate>
      <link>https://forem.com/curtlycritchlow/how-to-fix-javasecuritynosuchalgorithmexception-algorithm-hmacpbesha256-not-available-when-building-app-bundle-4cl7</link>
      <guid>https://forem.com/curtlycritchlow/how-to-fix-javasecuritynosuchalgorithmexception-algorithm-hmacpbesha256-not-available-when-building-app-bundle-4cl7</guid>
      <description>&lt;h2&gt;
  
  
  Indroduction
&lt;/h2&gt;

&lt;p&gt;In this article I'll share with you how I fixed a failed &lt;code&gt;flutter build app bundle&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;When I ran &lt;code&gt;flutter build app bundle&lt;/code&gt; in my terminal I got the below error.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Execution failed for task ':app:signReleaseBundle'.
&amp;gt; A failure occurred while executing com.android.build.gradle.internal.tasks.FinalizeBundleTask$BundleToolRunnable
   &amp;gt; Failed to read key upload from store "/Users/&amp;lt;your folder name&amp;gt;/upload-keystore.jks": Integrity check failed: java.security.NoSuchAlgorithmException: Algorithm HmacPBESHA256 not available

* Try:
&amp;gt; Run with --stacktrace option to get the stack trace.
&amp;gt; Run with --info or --debug option to get more log output.
&amp;gt; Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 8s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;The likely cause of this error is because the java version the app is built with is different for the java version being used to generate the signing key.&lt;/p&gt;

&lt;p&gt;To fix run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Run flutter doctor -v
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;...
[✓] Android toolchain - develop for Android devices (Android SDK version
    34.0.0-rc2)
    • Android SDK at /Users/&amp;lt;your folder path&amp;gt;/Library/Android/sdk
    • Platform android-33, build-tools 34.0.0-rc2
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Prefix the keygen command to point to the java version used to build your app and run you keygen command as shown below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/Applications/"Android Studio.app"/Contents/jre/jdk/Contents/Home/bin/keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run &lt;code&gt;flutter build appbundle&lt;/code&gt; and your build will be successful&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect with me
&lt;/h2&gt;

&lt;p&gt;Thank you for reading my post. Feel free to like, comment, subscribe or connect with me on &lt;a href="https://www.linkedin.com/in/curtlycritchlow/"&gt;LinkedIn&lt;/a&gt; and &lt;a href="https://twitter.com/CritchlowCurtly"&gt;Twitter&lt;/a&gt;. You can also &lt;a href="https://www.buymeacoffee.com/curtlycritchlow"&gt;buy me a book&lt;/a&gt; to show your support.&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>android</category>
    </item>
    <item>
      <title>How to fix Missing file libarclite_iphonesos.a(Xcode 14.3)</title>
      <dc:creator>Curtly Critchlow</dc:creator>
      <pubDate>Mon, 03 Apr 2023 21:53:01 +0000</pubDate>
      <link>https://forem.com/curtlycritchlow/how-to-fix-missing-file-libarcliteiphonesosaxcode-143-4hki</link>
      <guid>https://forem.com/curtlycritchlow/how-to-fix-missing-file-libarcliteiphonesosaxcode-143-4hki</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Have you updated Xcode to 14.3 and now you see missing file libarclite_iphonesos.a? If yes, you are reading the correct article. I'll share with you how I fixed error message.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open Xcode&lt;/li&gt;
&lt;li&gt;Select pods &lt;/li&gt;
&lt;li&gt;Select a package in targets&lt;/li&gt;
&lt;li&gt;Change Minimum Deployments to 13.0&lt;/li&gt;
&lt;li&gt;Repeat steps 3 to 4 until you change the minimum deployments for all you packages.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KQW7XlM1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/52uu65fr6rv1qpbr6ohq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KQW7XlM1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/52uu65fr6rv1qpbr6ohq.png" alt="change minimum deployments to 13.0" width="880" height="642"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your project should now run in your editor of choice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect with me
&lt;/h2&gt;

&lt;p&gt;Thank you for reading my post. Feel free to subscribe below or connect with me on &lt;a href="https://www.linkedin.com/in/curtlycritchlow/"&gt;LinkedIn&lt;/a&gt; and &lt;a href="https://twitter.com/CritchlowCurtly"&gt;Twitter&lt;/a&gt;. You can also &lt;a href="https://www.buymeacoffee.com/curtlycritchlow"&gt;buy me a book&lt;/a&gt; to show your support.&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>ios</category>
      <category>xcode</category>
    </item>
    <item>
      <title>How to Fix Failed Archive on Xcode 14.3 (rsync error: some files could not be transferred (code 23))</title>
      <dc:creator>Curtly Critchlow</dc:creator>
      <pubDate>Mon, 03 Apr 2023 21:20:30 +0000</pubDate>
      <link>https://forem.com/curtlycritchlow/how-to-fix-failed-archive-on-xcode-143-25fh</link>
      <guid>https://forem.com/curtlycritchlow/how-to-fix-failed-archive-on-xcode-143-25fh</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Have you updated Xcode to 14.3 and now your archive fails? If yes, you are reading the correct article. I'll share with you how I fixed failed Archive on Xcode 14.3.&lt;/p&gt;

&lt;h2&gt;
  
  
  The solution
&lt;/h2&gt;

&lt;p&gt;When the archive failed you might have see the rsync error below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;...
rsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/97f6331a-ba75-11ed-a4bc-863efbbaf80d/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9]
Command PhaseScriptExecution failed with a nonzero exit code
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fortunately the fix is very simple, Open the file Pods/Targets Support Files/Pods-Runner/Pods-Runner-framework&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4z1ad5fwyk3ur0cb0m6j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4z1ad5fwyk3ur0cb0m6j.png" alt="Pod-Runner-framework location"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Replace:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  if [ -L "${source}" ]; then
    echo "Symlinked..."
    source="$(readlink "${source}")"
  fi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  if [ -L "${source}" ]; then
    echo "Symlinked..."
    source="$(readlink -f "${source}")"
  fi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The -f was added.&lt;/p&gt;

&lt;p&gt;Your archive will now complete successfully.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect with me
&lt;/h2&gt;

&lt;p&gt;Thank you for reading my post. Feel free to subscribe below or connect with me on &lt;a href="https://www.linkedin.com/in/curtlycritchlow/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; and &lt;a href="https://twitter.com/CritchlowCurtly" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;. You can also &lt;a href="https://www.buymeacoffee.com/curtlycritchlow" rel="noopener noreferrer"&gt;buy me a book&lt;/a&gt; to show your support.&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>ios</category>
      <category>xcode</category>
    </item>
    <item>
      <title>Using the Custom Paint widget to Create a Linear Gauge - Part 1</title>
      <dc:creator>Curtly Critchlow</dc:creator>
      <pubDate>Fri, 14 Oct 2022 15:47:30 +0000</pubDate>
      <link>https://forem.com/curtlycritchlow/using-the-custom-paint-widget-to-create-a-linear-gauge-part-1-1gai</link>
      <guid>https://forem.com/curtlycritchlow/using-the-custom-paint-widget-to-create-a-linear-gauge-part-1-1gai</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;At the end of this tutorial series you will learn how to use the custom paint widget by creating a Linear Gauge. The custom paint widget allows you to draw and paint directly to the canvas. This is useful when you can't find or combine a pre build widget to meet your needs.&lt;/p&gt;

&lt;p&gt;At the end of this series your linear gauge will look like this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5dj5mc05tacvx4fx2bmd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5dj5mc05tacvx4fx2bmd.png" alt="simple linear gauge final"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a flutter project
&lt;/h2&gt;

&lt;p&gt;Before we start building a linear gauge, let's create our flutter project. In your terminal run;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ flutter create linear_gauge
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In &lt;code&gt;main.dart&lt;/code&gt; delete everything starting from line 7 and replace it with the following.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'linear_gauge.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyApp&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;StatelessWidget&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;MyApp&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="c1"&gt;// This widget is the root of your application.&lt;/span&gt;
  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="n"&gt;Widget&lt;/span&gt; &lt;span class="n"&gt;build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BuildContext&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;MaterialApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="nl"&gt;title:&lt;/span&gt; &lt;span class="s"&gt;'Linear Gauge'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;home:&lt;/span&gt; &lt;span class="n"&gt;LinearGauge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;maxValue:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;minValue:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;actualValue:&lt;/span&gt; &lt;span class="mi"&gt;75&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we have to create the &lt;code&gt;LinearGauge()&lt;/code&gt; widget.&lt;/p&gt;

&lt;h2&gt;
  
  
  How a linear gauge works
&lt;/h2&gt;

&lt;p&gt;From the image in the introduction we can deduce that the gauge need to be provided with a maximum value, a minimum value and an actual value. The gauge then displays the actual value in proportion to the maximum and minimum value.&lt;/p&gt;

&lt;p&gt;Let's create our stateful widget to represent this;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ touch lib/linear_gauge.dart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:flutter/material.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'linear_gauge_custom_painter.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;LinearGauge&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;StatefulWidget&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;LinearGauge&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="kd"&gt;required&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;maxValue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kd"&gt;required&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;minValue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kd"&gt;required&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;actualValue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Key&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;key:&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;maxValue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;minValue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;actualValue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="n"&gt;State&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;LinearGauge&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;createState&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;_LinearGaugeState&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;_LinearGaugeState&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;State&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;LinearGauge&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="n"&gt;Widget&lt;/span&gt; &lt;span class="n"&gt;build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BuildContext&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;Scaffold&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="nl"&gt;appBar:&lt;/span&gt; &lt;span class="n"&gt;AppBar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;title:&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Linear Gauge'&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
      &lt;span class="nl"&gt;body:&lt;/span&gt; &lt;span class="n"&gt;CustomPaint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nl"&gt;size:&lt;/span&gt; &lt;span class="n"&gt;MediaQuery&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;painter:&lt;/span&gt; &lt;span class="n"&gt;LinearGaugeCustomPainter&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
      &lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will notice our &lt;code&gt;body&lt;/code&gt; property accepts a &lt;code&gt;CustomPaint&lt;/code&gt; that takes in a &lt;code&gt;LinearGaugeCustomPainter&lt;/code&gt;. This class will be used to draw and paint our linear gauge into existence.&lt;/p&gt;

&lt;p&gt;We used &lt;code&gt;MediaQuery.of(context).size&lt;/code&gt; to ensure our gauge scales to the device size.&lt;/p&gt;

&lt;h2&gt;
  
  
  Components of a linear gauge
&lt;/h2&gt;

&lt;p&gt;Before we start painting it is important to breakdown our linear gauge into its components. From the image above we notice that the gauge comprises of;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;A main axis - this is the vertical part of the gauge.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Major ticks - This is the long horizontal lines&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Minor ticks - This is the short horizontal lines.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scale - The numbers that the ticks represents.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Pointer - The vertical line that colors the main axis from the minimum value to the actual value.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The actual value indicator - The icon that shows where the actual value is.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The actual Value - The TextPainter that displays the actual value.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ touch lib/linear_gauge_custom_painter.dart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:flutter/material.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;LinearGaugeCustomPainter&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;CustomPainter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;paint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Canvas&lt;/span&gt; &lt;span class="n"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Size&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// TODO: implement paint&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="n"&gt;shouldRepaint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;covariant&lt;/span&gt; &lt;span class="n"&gt;CustomPainter&lt;/span&gt; &lt;span class="n"&gt;oldDelegate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// TODO: implement shouldRepaint&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="n"&gt;UnimplementedError&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our LinearGaugeCustomPainter extends CustomPainter which gives us access to the &lt;code&gt;paint&lt;/code&gt; and &lt;code&gt;shouldRepaint&lt;/code&gt; methods.&lt;/p&gt;

&lt;p&gt;We will use our paint method to create the components mentioned above.&lt;/p&gt;

&lt;h3&gt;
  
  
  Drawing the main axis
&lt;/h3&gt;

&lt;p&gt;Before we draw the main axis we first have to determine where it will begin and end. the &lt;code&gt;size&lt;/code&gt; parameter contains the height and width of the canvas. We must draw within the limits of the width and height parameters or our drawing won't be visible on the screen.&lt;/p&gt;

&lt;p&gt;Let's define the start point and end point of our main axis.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;LinearGaugeCustomPainter&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;CustomPainter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;///find Main Axis start point&lt;/span&gt;
  &lt;span class="n"&gt;Offset&lt;/span&gt; &lt;span class="n"&gt;getMainAxisStartPoint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Size&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Offset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;width&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;height&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;///find Main Axis endpoint&lt;/span&gt;
  &lt;span class="n"&gt;Offset&lt;/span&gt; &lt;span class="n"&gt;getMainAxisEndPoint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Size&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Offset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;width&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;height&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;1.2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To draw the main axis we need to draw a line from a start point of our choosing to an endpoint of our choosing. We determine these point using the &lt;code&gt;Offset&lt;/code&gt; class. This class accepts a x-axis value and a y-axis value. &lt;/p&gt;

&lt;p&gt;To place the main axis of the gauge in the middle of the canvas along the x-axis we divide the &lt;code&gt;size.width&lt;/code&gt; by 2. We then set the y-axis to the lowest and highest point of the main axis by dividing the height of the canvas by a constant.&lt;/p&gt;

&lt;p&gt;The the constants 7 and 1.2 was chosen because those are the height position at with I want the main axis to start and end. Feel free to play around with the constants to determine your prefered starting and endpoints. The &lt;code&gt;size&lt;/code&gt; parameter is used to ensure the main axis scale in proportion to the height of the canvas on any device.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;LinearGaugeCustomPainter&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;CustomPainter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;...&lt;/span&gt;
  &lt;span class="c1"&gt;/// Draws the main axis of the Gauge&lt;/span&gt;
  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;drawGaugeMainAxis&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Canvas&lt;/span&gt; &lt;span class="n"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Size&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;gaugeMainAxisPainter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Paint&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;color&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Colors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;grey&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;shade300&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;strokeWidth&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;5.0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;canvas&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;drawLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;getMainAxisStartPoint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;getMainAxisEndPoint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;gaugeMainAxisPainter&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To draw the main axis we call the &lt;code&gt;canvas.drawLine()&lt;/code&gt; method and pass in the start point offset value and endpoint offset value. It also expects a &lt;code&gt;Paint()&lt;/code&gt; class that describes the style to use when drawing on the canvas.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;LinearGaugeCustomPainter&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;CustomPainter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;...&lt;/span&gt;

  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;paint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Canvas&lt;/span&gt; &lt;span class="n"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Size&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;drawGaugeMainAxis&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="n"&gt;shouldRepaint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;covariant&lt;/span&gt; &lt;span class="n"&gt;CustomPainter&lt;/span&gt; &lt;span class="n"&gt;oldDelegate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We call our &lt;code&gt;drawGaugeMainAxis()&lt;/code&gt; method in inside the &lt;code&gt;paint&lt;/code&gt; method since this method is called whenever the object needs to paint.&lt;/p&gt;

&lt;p&gt;We return true to our &lt;code&gt;shouldRepaint()&lt;/code&gt; since we'll be adding animation to our gauge and we'll need to repaint during the animation from 0 to the actual value.&lt;/p&gt;

&lt;p&gt;Run the code and our scale widget will look like;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5j67ptomtm660rcbvv55.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5j67ptomtm660rcbvv55.png" alt="main axis"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Conclusions&lt;/p&gt;

&lt;p&gt;We've created the main axis of our linear gauge and in the process learnt how to draw a line on the canvas at a start and endpoint of our choosing. In the next article in this series we'll learn how to position our major ticks along the main axis.&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>custompainterwidget</category>
      <category>lineargauge</category>
    </item>
    <item>
      <title>Benefits of building a cli app in dart.</title>
      <dc:creator>Curtly Critchlow</dc:creator>
      <pubDate>Wed, 28 Sep 2022 19:15:38 +0000</pubDate>
      <link>https://forem.com/curtlycritchlow/benefits-of-building-a-cli-app-in-dart-59he</link>
      <guid>https://forem.com/curtlycritchlow/benefits-of-building-a-cli-app-in-dart-59he</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This is the first article in the series "Building a command line interface app in dart". In this series, we will learn together how to build a cli in dart and publish it on &lt;a href="//pub.dev"&gt;pub.dev&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why build a cli?
&lt;/h2&gt;

&lt;p&gt;There are many reasons to build your cli app, my main reason is to &lt;strong&gt;automate repetitive tasks&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Personally, I hate, yes hate is a strong word, I hate doing the same thing twice. I hate repetitive tasks so much that I often procrastinate when I'm starting a new flutter project. I delay because every project will need the same things like adding themes, connecting the app to firebase, creating your folder structure, etc.&lt;/p&gt;

&lt;p&gt;To solve my procrastination problem once and for all, I've decided to build my opinionated cli. If I'm going to build a cli I might as well publish it to &lt;a href="//pub.dev"&gt;pub.dev&lt;/a&gt; to benefit developers who follow a similar workflow to mine.&lt;/p&gt;

&lt;p&gt;Other reasons to build a cli are, &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use your app without having to build a UI for it.&lt;/li&gt;
&lt;li&gt;To understand how cli app works &lt;/li&gt;
&lt;li&gt;To get familiar with using the terminal &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The million-dollar question is, how to build a cli in dart?&lt;/p&gt;

&lt;h2&gt;
  
  
  How to build a simple cli in dart?
&lt;/h2&gt;

&lt;p&gt;Fortunately, dart.dev give us a great starting point... I recommend your read their &lt;a href="https://dart.dev/tutorials/server/get-started"&gt;tutorial&lt;/a&gt;. That tutorial while being an amazing starting point is too simple for a relatively complex cli app. I'll leave you to read the aforementioned article and we'll continue our cli journey in the next article of this series where we will create our cli.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect with me
&lt;/h2&gt;

&lt;p&gt;Thank you for reading my post. Feel free to subscribe below to join me on the #100DaysOfCodeChallenge or connect with me on &lt;a href="https://www.linkedin.com/in/curtlycritchlow/"&gt;LinkedIn&lt;/a&gt; and &lt;a href="https://twitter.com/CritchlowCurtly"&gt;Twitter&lt;/a&gt;. You can also &lt;a href="https://www.buymeacoffee.com/curtlycritchlow"&gt;buy me a book&lt;/a&gt; to show your support.&lt;/p&gt;

</description>
      <category>dart</category>
      <category>cli</category>
      <category>flutter</category>
    </item>
    <item>
      <title>Livestock Information System - 100DaysOfCode - Days 23, 24, 25, 26</title>
      <dc:creator>Curtly Critchlow</dc:creator>
      <pubDate>Tue, 27 Jul 2021 03:01:50 +0000</pubDate>
      <link>https://forem.com/curtlycritchlow/livestock-information-system-100daysofcode-days-23-24-25-26-27lo</link>
      <guid>https://forem.com/curtlycritchlow/livestock-information-system-100daysofcode-days-23-24-25-26-27lo</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This post is part of my 100DaysOfCode series. In this series, I write about what I am learning on this challenge. I will be learning flutter and firebase by building an Agriculture Management Information System. This will consist of an app for crops and livestock.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recap
&lt;/h2&gt;

&lt;p&gt;On Day 22 we discussed why using form fields as descendants of a ListView is a bad idea.&lt;/p&gt;

&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;In this post, we will discuss the farm module added over the past four days. &lt;/p&gt;

&lt;h3&gt;
  
  
  Farm Form
&lt;/h3&gt;

&lt;p&gt;The farm form screen handles both the create and update scenarios. It contains text form fields, single and multi-select dropdown form fields. &lt;/p&gt;

&lt;p&gt;It also allows the user to get the current geolocation using the &lt;a href="https://api.flutter.dev/flutter/widgets/ListView-class.html"&gt;geolocator package&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Farm form data is stored on cloud firestore while the farm profile picture is stored on cloud storage.&lt;/p&gt;

&lt;p&gt;The farm list and detail screens both use a query snapshot and a document snapshot to ensure real-time functionality.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap Up
&lt;/h2&gt;

&lt;p&gt;In this post, we discussed we discussed the farm module added over the past four days.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect with me
&lt;/h2&gt;

&lt;p&gt;Thank you for reading my post. Feel free to subscribe below to join me on the #100DaysOfCodeChallenge or connect with me on &lt;a href="https://www.linkedin.com/in/curtlycritchlow/"&gt;LinkedIn&lt;/a&gt; and &lt;a href="https://twitter.com/CritchlowCurtly"&gt;Twitter&lt;/a&gt;. You can also &lt;a href="https://www.buymeacoffee.com/curtlycritchlow"&gt;buy me a book&lt;/a&gt; to show your support.&lt;/p&gt;

</description>
      <category>100daysofcode</category>
      <category>flutter</category>
      <category>dart</category>
      <category>firebase</category>
    </item>
    <item>
      <title>Why using form fields as descendants of a Listview is a bad idea - #100DaysOfCode - Day 22</title>
      <dc:creator>Curtly Critchlow</dc:creator>
      <pubDate>Fri, 23 Jul 2021 00:30:42 +0000</pubDate>
      <link>https://forem.com/curtlycritchlow/why-using-form-fields-as-descendants-of-a-listview-is-a-bad-idea-100daysofcode-day-22-43hl</link>
      <guid>https://forem.com/curtlycritchlow/why-using-form-fields-as-descendants-of-a-listview-is-a-bad-idea-100daysofcode-day-22-43hl</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This post is part of my 100DaysOfCode series. In this series, I write about what I am learning on the 100DaysOfCode challenge. For this challenge, I will be learning flutter and firebase by building an Agriculture Management Information System.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recap
&lt;/h2&gt;

&lt;p&gt;On Day 21 we mainly discussed the difficulty I had with writing widget tests for my Flutter app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;In this post, we will discuss why using form fields as descendants of a &lt;a href="https://api.flutter.dev/flutter/widgets/ListView-class.html"&gt;Listview&lt;/a&gt; is a bad idea. &lt;/p&gt;

&lt;h3&gt;
  
  
  ListView Gotcha
&lt;/h3&gt;

&lt;p&gt;ListView is a scrolling widget that displays its children one by one. When a child is scrolled out of view, the associated element subtree, states and render objects are destroyed. The means that user input from widgets like &lt;a href="https://api.flutter.dev/flutter/material/TextFormField-class.html"&gt;TextFormField&lt;/a&gt; will be lost when the widget is scrolled out of view. While they are ways to keep state mentioned &lt;a href="https://api.flutter.dev/flutter/widgets/ListView-class.html"&gt;here&lt;/a&gt;, I prefer to use a SingleChildScrollView with a row or column as its child to accommodate multiple widgets as shown below.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SingleChildScrollView(child:Column(children:yourFormChildren));&lt;/code&gt; solution from &lt;a href="https://stackoverflow.com/questions/45240734/flutter-form-data-disappears-when-i-scroll"&gt;stackoverflow&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap Up
&lt;/h2&gt;

&lt;p&gt;In this post, we discussed why using form fields as descendants of a ListView is a bad idea.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect with me
&lt;/h2&gt;

&lt;p&gt;Thank you for reading my post. Feel free to subscribe below to join me on the #100DaysOfCodeChallenge or connect with me on &lt;a href="https://www.linkedin.com/in/curtlycritchlow/"&gt;LinkedIn&lt;/a&gt; and &lt;a href="https://twitter.com/CritchlowCurtly"&gt;Twitter&lt;/a&gt;. You can also &lt;a href="https://www.buymeacoffee.com/curtlycritchlow"&gt;buy me a book&lt;/a&gt; to show your support.&lt;/p&gt;

</description>
      <category>100daysofcode</category>
      <category>flutter</category>
      <category>dart</category>
    </item>
  </channel>
</rss>
