<?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"><channel><title><![CDATA[ccwc blog]]></title><description><![CDATA[ccwc blog]]></description><link>https://blog.ccwc.io</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 02:09:18 GMT</lastBuildDate><atom:link href="https://blog.ccwc.io/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[A Step-by-Step Guide to Internationalizing Flutter App]]></title><description><![CDATA[Introduction
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 expla...]]></description><link>https://blog.ccwc.io/a-step-by-step-guide-to-internationalizing-flutter-app</link><guid isPermaLink="true">https://blog.ccwc.io/a-step-by-step-guide-to-internationalizing-flutter-app</guid><category><![CDATA[Flutter]]></category><category><![CDATA[flutter development]]></category><category><![CDATA[localization]]></category><category><![CDATA[internationalization]]></category><category><![CDATA[mobile app development]]></category><dc:creator><![CDATA[Curtly Critchlow]]></dc:creator><pubDate>Tue, 13 Jun 2023 18:00:39 GMT</pubDate><content:encoded><![CDATA[<h3 id="heading-introduction">Introduction</h3>
<p>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 <a target="_blank" href="https://docs.flutter.dev/accessibility-and-localization/internationalization#introduction-to-localizations-in-flutter">recommended resource</a> on Internationalizing Flutter apps.</p>
<h3 id="heading-configuration-settings">Configuration settings</h3>
<p>To get started, follow these steps:</p>
<ol>
<li>Create your Flutter project and execute the following code to download the required packages:<pre><code class="lang-bash"> flutter pub add flutter_localizations --sdk=flutter
 flutter pub add intl:any
</code></pre>
</li>
<li>In your <code>pubspec.yaml</code> file, add the following code under the Flutter section:<pre><code class="lang-yaml"> <span class="hljs-comment"># The following section </span>
 <span class="hljs-string">is</span> <span class="hljs-string">specific</span> <span class="hljs-string">to</span> <span class="hljs-string">Flutter.</span>
 <span class="hljs-attr">flutter:</span>
   <span class="hljs-attr">generate:</span> <span class="hljs-literal">true</span> <span class="hljs-comment"># Add this line</span>
</code></pre>
</li>
<li>Create a <code>l10n.yaml</code> file in the root folder of your project:<pre><code class="lang-bash"> touch l10n.yaml
</code></pre>
</li>
<li><p>Open the <code>l10n.yaml</code> file and add the following content:</p>
<pre><code class="lang-yaml"> <span class="hljs-attr">arb-dir:</span> <span class="hljs-string">lib/l10n</span>
 <span class="hljs-attr">template-arb-file:</span> <span class="hljs-string">app_en.arb</span>
 <span class="hljs-attr">output-localization-file:</span> <span class="hljs-string">app_localizations.dart</span>
</code></pre>
<ul>
<li><p>Specify the <code>arb-dir</code> parameter with the folder path where your    <code>.arb</code> file will be stored.</p>
</li>
<li><p>Set the <code>template-arb-file</code> parameter with the name of your .arb file. The naming convention is <code>app_&lt;language_code&gt;.arb</code> , where <code>&lt;language_code&gt;</code> represents the language code (e.g., "en" for English, "es" for Spanish). You can create multiple <code>.arb</code> files for different languages you intend to support.</p>
</li>
</ul>
</li>
<li>Create the <code>arb</code> folder and the <code>app_en.arb</code> file:<pre><code class="lang-bash"> mkdir lib/l10n
 touch lib/l10n/app_en.arb
</code></pre>
</li>
<li>Open <code>lib/l10n/app_en.arb</code> and add the following content:<pre><code class="lang-json"> {
 <span class="hljs-attr">"materialAppTitle"</span>: <span class="hljs-string">"localizations Sample App'
 }</span>
</code></pre>
</li>
<li>Run the following command to generate the necessary configuration file:<pre><code class="lang-bash"> flutter gen-l10n
</code></pre>
</li>
</ol>
<h3 id="heading-adding-localization-to-your-app">Adding localization to your app</h3>
<p>To integrate localization into you app, follow these steps:</p>
<ol>
<li>In <code>main.dart</code> , import <code>app_localizations.dart</code> :<pre><code class="lang-dart"> <span class="hljs-keyword">import</span> <span class="hljs-string">'package:flutter_gen/gen_l10n/app_localizations.dart'</span>;
</code></pre>
</li>
<li>Within the <code>MaterialApp</code> widget, add <code>AppLocalizations.localization</code> as the <code>localizationsDelegates</code> parameter and <code>AppLocalizations.supportedLocales</code> as the <code>supportedLocales</code> parameter:<pre><code class="lang-dart"> MaterialApp(
       localizationsDelegates: AppLocalizations.localizationsDelegates,
       supportedLocales: AppLocalizations.supportedLocales,
       home: Builder(builder: (context) {
         <span class="hljs-keyword">return</span> Scaffold(
           body: Center(child:    Text(AppLocalizations.of(context)!.materialAppTitle)),
         );
       }),
     );
</code></pre>
</li>
<li>Whenever you update the <code>app_en.arb</code> file, run <code>flutter gen-l10n</code> to update it. Alternatively, if you're using Visual Studio Code, right-click on the <code>app_en.arb</code> file and select "Generate Localizations".</li>
<li>Run your Flutter app and it should now support localization.</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1686622424386/340cc948-2d65-4f18-94f6-458216c051de.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-conclusion">Conclusion</h3>
<p>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.</p>
]]></content:encoded></item><item><title><![CDATA[How to Fix 'AssetManifest' is imported from both 'package:flutter...' and 'package:google_fonts...' error]]></title><description><![CDATA[Introduction
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'.
When you run your flutter app you might notice thi...]]></description><link>https://blog.ccwc.io/how-to-fix-assetmanifest-is-imported-from-both-packageflutter-and-packagegooglefonts-error</link><guid isPermaLink="true">https://blog.ccwc.io/how-to-fix-assetmanifest-is-imported-from-both-packageflutter-and-packagegooglefonts-error</guid><category><![CDATA[Flutter]]></category><category><![CDATA[Flutter Examples]]></category><category><![CDATA[Dart]]></category><category><![CDATA[flut]]></category><dc:creator><![CDATA[Curtly Critchlow]]></dc:creator><pubDate>Fri, 26 May 2023 00:00:39 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p>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'.</p>
<p>When you run your flutter app you might notice this error in your debug console.</p>
<pre><code class="lang-plaintext">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 &lt;{}codename&gt;,&lt;{}layoutlib&gt;,&lt;{}api-level&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';
^^^^^^^^^^^^^
</code></pre>
<h2 id="heading-solution">Solution</h2>
<p>Fortunately, this is a simple fix, update your <code>google_fonts:</code> package in <code>pubspec.yaml</code> to the <a target="_blank" href="https://pub.dev/packages/google_fonts">latest version</a></p>
<p>Run your Flutter app and your code should be fine.</p>
<h2 id="heading-connect-with-me">Connect with me</h2>
<p>Thank you for reading my post. Feel free to like, comment, subscribe</p>
]]></content:encoded></item><item><title><![CDATA[How to fix Missing file libarclite_iphonesos.a(Xcode 14.3)]]></title><description><![CDATA[Introduction
Have you updated Xcode to 14.3 and now you see the error missing file libarclite_iphonesos.a? If yes, you are reading the correct article. I'll share with you how I fixed the error.
Solution

Open Xcode

Select pods

Select a package in ...]]></description><link>https://blog.ccwc.io/how-to-fix-missing-file-libarcliteiphonesosaxcode-143</link><guid isPermaLink="true">https://blog.ccwc.io/how-to-fix-missing-file-libarcliteiphonesosaxcode-143</guid><category><![CDATA[Flutter]]></category><category><![CDATA[iOS]]></category><category><![CDATA[Xcode]]></category><dc:creator><![CDATA[Curtly Critchlow]]></dc:creator><pubDate>Thu, 25 May 2023 14:00:39 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p>Have you updated Xcode to 14.3 and now you see the error missing file libarclite_iphonesos.a? If yes, you are reading the correct article. I'll share with you how I fixed the error.</p>
<h2 id="heading-solution">Solution</h2>
<ol>
<li><p>Open Xcode</p>
</li>
<li><p>Select pods</p>
</li>
<li><p>Select a package in the targets</p>
</li>
<li><p>Change Minimum Deployments to 13.0</p>
</li>
<li><p>Repeat steps 3 to 4 until you change the minimum deployments for all your packages.</p>
</li>
</ol>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/52uu65fr6rv1qpbr6ohq.png" alt="change minimum deployments to 13.0" /></p>
<p>Your project should now run in your editor of choice.</p>
<h2 id="heading-connect-with-me">Connect with me</h2>
<p>Thank you for reading my post. Feel free to connect with me</p>
]]></content:encoded></item><item><title><![CDATA[How to Fix Failed Archive on Xcode 14.3 (rsync error: some files could not be transferred (code 23))]]></title><description><![CDATA[Introduction
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.
The solution
When the archive failed you might have seen the rsync erro...]]></description><link>https://blog.ccwc.io/how-to-fix-failed-archive-on-xcode-143-rsync-error-some-files-could-not-be-transferred-code-23</link><guid isPermaLink="true">https://blog.ccwc.io/how-to-fix-failed-archive-on-xcode-143-rsync-error-some-files-could-not-be-transferred-code-23</guid><category><![CDATA[Flutter]]></category><category><![CDATA[ios app development]]></category><category><![CDATA[iOS]]></category><category><![CDATA[Xcode]]></category><dc:creator><![CDATA[Curtly Critchlow]]></dc:creator><pubDate>Thu, 25 May 2023 13:30:39 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p>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.</p>
<h2 id="heading-the-solution">The solution</h2>
<p>When the archive failed you might have seen the rsync error below.</p>
<pre><code class="lang-plaintext">...
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
</code></pre>
<p>Fortunately, the fix is very simple, Open the file Pods/Targets Support Files/Pods-Runner/Pods-Runner-framework</p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4z1ad5fwyk3ur0cb0m6j.png" alt="Pod-Runner-framework location" /></p>
<p>Replace:</p>
<pre><code class="lang-plaintext">  if [ -L "${source}" ]; then
    echo "Symlinked..."
    source="$(readlink "${source}")"
  fi
</code></pre>
<p>with:</p>
<pre><code class="lang-plaintext">  if [ -L "${source}" ]; then
    echo "Symlinked..."
    source="$(readlink -f "${source}")"
  fi
</code></pre>
<p>The -f was added.</p>
<p>Your archive will now complete successfully.</p>
<h2 id="heading-connect-with-me">Connect with me</h2>
<p>Thank you for reading my post. Feel free to connect with me</p>
]]></content:encoded></item><item><title><![CDATA[How to fix java.security.NoSuchAlgorithmException: Algorithm HmacPBESHA256 not available when building app bundle]]></title><description><![CDATA[Introduction
In this article, I'll share with you how I fixed a failed flutter build app bundle command.
When I ran flutter build app bundle in my terminal I got the below error.
Execution failed for task ':app:signReleaseBundle'.
> A failure occurre...]]></description><link>https://blog.ccwc.io/how-to-fix-javasecuritynosuchalgorithmexception-algorithm-hmacpbesha256-not-available-when-building-app-bundle</link><guid isPermaLink="true">https://blog.ccwc.io/how-to-fix-javasecuritynosuchalgorithmexception-algorithm-hmacpbesha256-not-available-when-building-app-bundle</guid><category><![CDATA[Flutter]]></category><category><![CDATA[Android]]></category><dc:creator><![CDATA[Curtly Critchlow]]></dc:creator><pubDate>Thu, 25 May 2023 13:00:42 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p>In this article, I'll share with you how I fixed a failed <code>flutter build app bundle</code> command.</p>
<p>When I ran <code>flutter build app bundle</code> in my terminal I got the below error.</p>
<pre><code class="lang-plaintext">Execution failed for task ':app:signReleaseBundle'.
&gt; A failure occurred while executing com.android.build.gradle.internal.tasks.FinalizeBundleTask$BundleToolRunnable
   &gt; Failed to read key upload from store "/Users/&lt;your folder name&gt;/upload-keystore.jks": Integrity check failed: java.security.NoSuchAlgorithmException: Algorithm HmacPBESHA256 not available

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

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

BUILD FAILED in 8s
</code></pre>
<h2 id="heading-solution">Solution</h2>
<p>The likely cause of this error is that the Java version the app is built with is different from the Java version being used to generate the signing key.</p>
<p>To fix run</p>
<pre><code class="lang-plaintext">Run flutter doctor -v
</code></pre>
<pre><code class="lang-plaintext">...
[✓] Android toolchain - develop for Android devices (Android SDK version
    34.0.0-rc2)
    • Android SDK at /Users/&lt;your folder path&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.

...
</code></pre>
<p>Prefix the keygen command to point to the Java version used to build your app and run your keygen command as shown below.</p>
<pre><code class="lang-plaintext">/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
</code></pre>
<p>Run <code>flutter build appbundle</code> and your build will be successful</p>
<h2 id="heading-connect-with-me">Connect with me</h2>
<p>Thank you for reading my post. Feel free to connect with me.</p>
]]></content:encoded></item><item><title><![CDATA[How to fix core/duplicate-app] A Firebase App named "[DEFAULT]" already exists error]]></title><description><![CDATA[Introduction
In this article, we will cover the fix for [core/duplicate-app] A Firebase App named "[DEFAULT]" already exists exception.
If you tried running your Flutter app that's using a Firebase product you might see this error if your GoogleServi...]]></description><link>https://blog.ccwc.io/how-to-fix-coreduplicate-app-a-firebase-app-named-default-already-exists-error</link><guid isPermaLink="true">https://blog.ccwc.io/how-to-fix-coreduplicate-app-a-firebase-app-named-default-already-exists-error</guid><category><![CDATA[flutter]]></category><category><![CDATA[Firebase]]></category><category><![CDATA[macOS]]></category><dc:creator><![CDATA[Curtly Critchlow]]></dc:creator><pubDate>Thu, 25 May 2023 12:30:39 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p>In this article, we will cover the fix for [core/duplicate-app] A Firebase App named "[DEFAULT]" already exists exception.</p>
<p>If you tried running your Flutter app that's using a Firebase product you might see this error if your <code>GoogleService-Info.plist</code> or <code>google-services.json</code> files are outdated.</p>
<pre><code class="lang-plaintext">[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: [core/duplicate-app] A Firebase App named "[DEFAULT]" already exists
</code></pre>
<h2 id="heading-solution">Solution</h2>
<p>To fix the <code>core/duplicate-app] A Firebase App named "[DEFAULT]" already exists</code> exception follow these two simple steps</p>
<ol>
<li><p>Delete your <code>google-services.json</code> located at <code>android/app/google-services.json</code> if running on Android or delete your <code>GoogleService-Info.plist</code> located at <code>macos/Runner/GoogleService-Info.plist</code> if running on MacOS or <code>ios/Runner/GoogleService-Info.plist</code> if running on IOS.</p>
</li>
<li><p>Install and Run the flutterFire CLI in the root of your flutter project directory.</p>
</li>
</ol>
<p>If flutterFire CLI is not already installed run</p>
<pre><code class="lang-plaintext">$ dart pub global activate flutterfire_cli
</code></pre>
<p>Next Run</p>
<pre><code class="lang-plaintext">$ flutterfire configure --project=&lt;yourprojectID&gt;
</code></pre>
<p>Follow the instructions in your terminal.</p>
<p>Your Flutter project should now run successfully.</p>
<h2 id="heading-connect-with-me">Connect with me</h2>
<p>Thank you for reading my post. Feel free to connect with me.</p>
]]></content:encoded></item><item><title><![CDATA[Creating a Dynamic Dropdown Form Field in flutter]]></title><description><![CDATA[Overview
In this post, we will discuss how to create a dynamic dropdown form field in Flutter. We will be using two DropdownFormField() widget. A region dropdown field and a district dropdown field.
A region is the USA equivalent of a state and a dis...]]></description><link>https://blog.ccwc.io/creating-a-dynamic-dropdown-form-field-in-flutter</link><guid isPermaLink="true">https://blog.ccwc.io/creating-a-dynamic-dropdown-form-field-in-flutter</guid><category><![CDATA[Flutter]]></category><category><![CDATA[Flutter Examples]]></category><category><![CDATA[Flutter Widgets]]></category><category><![CDATA[flutter]]></category><category><![CDATA[Flutter]]></category><dc:creator><![CDATA[Curtly Critchlow]]></dc:creator><pubDate>Wed, 24 May 2023 15:23:42 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-overview">Overview</h2>
<p>In this post, we will discuss how to create a dynamic dropdown form field in Flutter. We will be using two <code>DropdownFormField()</code> widget. A region dropdown field and a district dropdown field.</p>
<p>A region is the USA equivalent of a state and a district is a sub-location within a region. These two fields along with other fields comprise our Farmer Register Form as shown in the screenshot below</p>
<p><img src="https://drive.google.com/uc?id=1iErcTZmW5965gvPiyEmXQh-Qoglwgi9q" alt="Updated Add Farmer Screen" /></p>
<p>My goal is to filter the options in the district depending on the region selected by the user. The purpose of this methodology is to reduce the number of options in the district dropdown field.</p>
<h2 id="heading-region-dropdown-form-field">Region Dropdown Form Field</h2>
<pre><code class="lang-Dart"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">RegionDropdownFormField</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">StatelessWidget</span> </span>{
  <span class="hljs-keyword">const</span> RegionDropdownFormField({
    Key? key,
    <span class="hljs-keyword">required</span> <span class="hljs-keyword">this</span>.state,
  }) : <span class="hljs-keyword">super</span>(key: key);

  <span class="hljs-keyword">final</span> _AddFarmerScreenController state;

  <span class="hljs-meta">@override</span>
  Widget build(BuildContext context) {
    <span class="hljs-keyword">return</span> Expanded(
      flex: <span class="hljs-number">5</span>,
      child: DropdownButtonFormField(
        focusNode: state.regionFocusNode,
        decoration: FormStyles.textFieldDecoration(labelText: <span class="hljs-string">'Region'</span>),
        onChanged: (<span class="hljs-built_in">String?</span> value) {
          state.setState(() {
            state.dropdownMenuItems = state._districtItem(value!);
            state.value = state.dropdownMenuItems!.first.value;
          });
        },
        validator: state.farmer.validateRequiredField,
        onSaved: state.farmer.saveFarmerCategory,
        items: Region.all
            .map((e) =&gt; DropdownMenuItem(
                  child: Text(e),
                  value: e,
                ))
            .toList(),
      ),
    );
  }
}
</code></pre>
<p>When the user selects an option from the <code>RegionDropdownFormField()</code> the <code>onChanged:</code> function will be triggered.</p>
<pre><code class="lang-Dart">(<span class="hljs-built_in">String?</span> value) {
          state.setState(() {
            state.districtDropdownMenuItems = state._getDistrictItems(value!);
            state.districtValue = state.districtDropdownMenuItems!.first.value;
          });
        }
</code></pre>
<p>This function calls <code>setState()</code> since we want the UI to update. Within <code>setstate()</code>, <code>state.districtDropdownMenuItems = state._getDistrictItems(value!);</code> creates a list of <code>dropdownMenuItem()</code> based on the value selected by the user. <code>state.districtDropdownMenuItems</code> will be assigned to the <code>items:</code> property of the <code>DistrictDropdownFormField()</code>.</p>
<p><code>state.districtValue = state.districtDropdownMenuItems!.first.value;</code> selects the first value of the newly created <code>state.districtDropdownMenuItems</code>. This variable will be assigned to the <code>value:</code> property of the <code>DistrictDropdownFormField()</code>. Failure to do this will create the below error.</p>
<pre><code class="lang-Dart">════════ Exception caught by widgets <span class="hljs-keyword">library</span> ═══════════════════════════════════
The following assertion was thrown building Builder(dirty, dependencies: [_FocusMarker]):
There should be exactly one item <span class="hljs-keyword">with</span> [DropdownButton]<span class="hljs-string">'s value: District 6. 
Either zero or 2 or more [DropdownMenuItem]s were detected with the same value
'</span>package:flutter/src/material/dropdown.dart<span class="hljs-string">':
Failed assertion: line 850 pos 15: '</span>items == <span class="hljs-keyword">null</span> || items.isEmpty || value == <span class="hljs-keyword">null</span> ||
              items.where((DropdownMenuItem&lt;T&gt; item) {
                <span class="hljs-keyword">return</span> item.value == value;
              }).length == <span class="hljs-number">1</span><span class="hljs-string">'</span>
</code></pre>
<h2 id="heading-district-dropdown-formfield">District Dropdown FormField</h2>
<pre><code class="lang-Dart"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">DistrictDropdownFormField</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">StatelessWidget</span> </span>{
  <span class="hljs-keyword">const</span> DistrictDropdownFormField({
    Key? key,
    <span class="hljs-keyword">required</span> <span class="hljs-keyword">this</span>.state,
  }) : <span class="hljs-keyword">super</span>(key: key);

  <span class="hljs-keyword">final</span> _AddFarmerScreenController state;

  <span class="hljs-meta">@override</span>
  Widget build(BuildContext context) {
    <span class="hljs-keyword">return</span> Expanded(
      flex: <span class="hljs-number">5</span>,
      child: DropdownButtonFormField(
        focusNode: state.districtFocusNode,
        decoration: FormStyles.textFieldDecoration(labelText: <span class="hljs-string">'District'</span>),
        onChanged: (value) =&gt;
            state._handleDropdownOnChanged(state.districtFocusNode),
        validator: state.farmer.validateRequiredField,
        onSaved: state.farmer.saveDistrict,
        value: state.districtValue,
        items: state.districtDropdownMenuItems,
      ),
    );
  }
}
</code></pre>
<p>This widget is a typical <code>DropdownFormField()</code> but note, <code>value: state.districtValue</code>, and <code>items: state.districtDropdownMenuItems,</code> are dependent on the region selected in the <code>DistrictDropdownFormField()</code>.</p>
<h2 id="heading-wrap-up">Wrap Up</h2>
<p>In this post, we discussed how to create a dynamic dropdown form field.</p>
<h2 id="heading-connect-with-me">Connect with me</h2>
<p>Thank you for reading my post. Feel free to follow me for more flutter tips and tricks or connect with me on <a target="_blank" href="https://www.linkedin.com/in/curtlycritchlow/">LinkedIn</a> and <a target="_blank" href="https://twitter.com/CritchlowCurtly">Twitter</a>. You can also <a target="_blank" href="https://www.buymeacoffee.com/curtlycritchlow">buy me a book</a> to show your support.</p>
]]></content:encoded></item></channel></rss>