<?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 Adil Cholas on Medium]]></title>
        <description><![CDATA[Stories by Adil Cholas on Medium]]></description>
        <link>https://medium.com/@adilcholas?source=rss-868d88120431------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*0SKLKp7wH0M-hbe9</url>
            <title>Stories by Adil Cholas on Medium</title>
            <link>https://medium.com/@adilcholas?source=rss-868d88120431------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 23:45:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@adilcholas/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[Deploying Your Flutter Web App Like a Pro: A 2026 Comprehensive Guide]]></title>
            <link>https://medium.com/@adilcholas/deploying-your-flutter-web-app-like-a-pro-a-2026-comprehensive-guide-ac7207e9efde?source=rss-868d88120431------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac7207e9efde</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-web]]></category>
            <dc:creator><![CDATA[Adil Cholas]]></dc:creator>
            <pubDate>Sun, 15 Feb 2026 19:54:37 GMT</pubDate>
            <atom:updated>2026-02-15T19:54:37.131Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QHzl_S21it1bJEczaLOJ_A.png" /></figure><p>As a Flutter developer, reaching the “web” milestone is exhilarating. However, the transition from localhost to a live production server involves more than just a single command. In 2026, with the introduction of <strong>Wasm (WebAssembly)</strong> support and specialized <strong>Web Renderers</strong>, the deployment landscape has evolved.</p><p>This guide provides a “clear-cut” roadmap to prepare, build, and publish your Flutter web application to various hosting environments.</p><h3>Phase 1: Preparation &amp; Optimization</h3><p>Before running your build command, you must optimize your app for the web environment.</p><ol><li><strong>Check Browser Compatibility:</strong> Flutter web supports Chrome, Firefox, Safari, and Edge. Ensure your plugins (especially those using dart:io) are replaced with web-compatible alternatives like package:http.</li><li><strong>Navigation &amp; URL Strategy:</strong> By default, Flutter uses a “hash” (#) in the URL. For a cleaner look (e.g., myapp.com/login), use the flutter_web_plugins library:</li></ol><pre>import &#39;package:flutter_web_plugins/url_strategy.dart&#39;;  <br>void main() {   <br>  usePathUrlStrategy();   <br>  runApp(MyApp()); <br>}</pre><p><strong>3. CORS Policy:</strong> If your app connects to a private backend, ensure your server headers allow requests from your production domain.</p><h3>Phase 2: Local Environment Testing</h3><p>Before you upload a single byte to a provider, you must test the “Production Build” locally. Running flutter run -d chrome is a debug mode; it doesn&#39;t represent the final performance or file structure.</p><h4>1. Generate the Production Build</h4><p>Run the following command to create the minified, tree-shaken files:</p><pre>flutter build web --release<br><br>//or use below command to go with material icons<br>flutter build web --release --no-tree-shake-icons</pre><p>This creates a build/web directory containing your index.html, main.dart.js, and assets.</p><h4>2. The Python Local Server Method</h4><p>Browsers restrict certain features (like Service Workers and specific API calls) when opening an HTML file directly from the file explorer (file://). You need a local HTTP server.</p><p>Python provides the quickest way to simulate a real web server:</p><ul><li>Open your terminal/command prompt.</li><li>Navigate into the build folder: cd build/web</li><li>Start the server: (You must install Python in your system, and use the commands respectively. **python3)</li></ul><pre>python -m http.server 8000</pre><ul><li>Open your browser and go to: <a href="http://localhost:8000/">http://localhost:8000</a></li></ul><h3>Phase 2: Building for Production</h3><p>In 2026, the flutter build web command is more powerful than ever. You have two primary paths:</p><h4>Option A: Standard JavaScript Build</h4><p>Best for maximum compatibility across all browsers.</p><pre>flutter build web --release</pre><h4>Option B: WebAssembly (Wasm) Build</h4><p>Best for performance-heavy apps (calculators, editors, etc.)</p><p><em>Note: Requires browsers that support WasmGC.</em></p><pre>flutter build web --wasm</pre><h4>Choosing Your Renderer</h4><p>You can force a specific renderer depending on your needs:</p><ul><li><strong>CanvasKit:</strong> Better performance and consistency, but larger download size (~1.5MB).</li><li><strong>SKWasm:</strong> The 2026 standard for Wasm-based builds.</li><li><strong>Auto (Default):</strong> Picks the best for the user’s browser.</li></ul><h3>Phase 3: Deployment Strategies</h3><p>Once built, your files reside in the build/web directory. Here is how to host them:</p><h4>1. Firebase Hosting (Recommended for Flutter)</h4><p>Firebase is deeply integrated with Flutter and provides a Global CDN and SSL for free.</p><ul><li><strong>Step 1:</strong> Install Firebase Tools:</li></ul><pre>npm install -g firebase-tools</pre><ul><li><strong>Step 2:</strong> Login and Init:</li></ul><pre>firebase login firebase init hosting</pre><ul><li><em>Public Directory:</em> Set to build/web</li><li><em>Configure as SPA:</em> Select <strong>Yes</strong>.</li><li><strong>Step 3:</strong> Deploy:</li></ul><pre>firebase deploy</pre><h4>2. Traditional VPS (Nginx/Apache)</h4><p>If you have your own Linux server, you can serve the build/web folder as static content.</p><p><strong>Nginx Configuration Example:</strong></p><pre>server {<br>    listen 80;<br>    server_name yourdomain.com;location / {<br>        root /var/www/my_flutter_app/build/web;<br>        index index.html;<br>        try_files $uri $uri/ /index.html; # Essential for SPA routing<br>    }<br>}</pre><h4>3. Netlify / Vercel (CI/CD)</h4><p>These platforms are excellent for “Push to Deploy” workflows.</p><ul><li>Connect your GitHub repository.</li><li><strong>Build Command:</strong> flutter/bin/flutter build web --release</li><li><strong>Publish Directory:</strong> build/web</li></ul><h4>Phase 4: Verification Checklist</h4><p>After your site is live, verify these three critical points:</p><ul><li><strong>PWA Support:</strong> Check if the manifest.json is loading correctly so users can &quot;Install&quot; your web app.</li><li><strong>Loading Speed:</strong> Use <strong>Chrome DevTools (Lighthouse)</strong> to check your initial bundle size. If it’s too large, ensure you are using --release to enable tree-shaking.</li><li><strong>Favicons:</strong> Replace the default Flutter logo in web/favicon.png with your branding.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac7207e9efde" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Code to App Store: A Chill Guide to Deploying Your Flutter App ]]></title>
            <link>https://medium.com/@adilcholas/from-code-to-app-store-a-chill-guide-to-deploying-your-flutter-app-e9b096dd5f8d?source=rss-868d88120431------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9b096dd5f8d</guid>
            <dc:creator><![CDATA[Adil Cholas]]></dc:creator>
            <pubDate>Tue, 10 Feb 2026 05:56:23 GMT</pubDate>
            <atom:updated>2026-02-10T05:56:23.970Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gzsaPoELIlL-hEvcmdX4_Q.png" /></figure><p>So, you’ve built a Flutter app. It looks great, the widgets are nesting perfectly, and you’re feeling like a coding wizard. But now comes the part that makes even grown developers sweat: <strong>The Apple App Store.</strong></p><p>Don’t worry. We’re going to walk through this together, step-by-step, like we’re grabbing a coffee. No jargon, no stress — just a clear path to getting that “Published” badge.</p><h3>🪂 Step 1: The Prerequisites (The “Don’t Forget Your Keys” List)</h3><p>Before we touch a single line of deployment code, you need:</p><ul><li><strong>A Mac:</strong> Apple is strict. No Mac, no App Store. (Yes, you can use a Mac Mini or a cloud Mac, but you need macOS).</li><li><strong>Apple Developer Account:</strong> Go to <a href="https://developer.apple.com/">developer.apple.com</a> and sign up. It’s $99/year.</li><li><strong>Xcode:</strong> Download the latest version from the Mac App Store.</li><li><strong>Asset Prep:</strong> * <strong>App Icon:</strong> 1024x1024px, 100% opaque (no transparency!), and no rounded corners — Apple rounds them for you.</li><li><strong>Screenshots:</strong> You’ll need shots for the 6.5&quot; display (iPhone 14/13/12 Pro Max) and 5.5&quot; display (iPhone 8 Plus).</li></ul><h3>🔐 Step 2: Certificates &amp; Identifiers (The ID Check)</h3><p>This is where beginners usually get lost. Think of this as getting your passport ready.</p><ol><li><strong>Developer Console vs. App Store Connect:</strong></li></ol><p><strong>2. Developer Console:</strong> The “Backstage.” Where you manage certificates, register your test devices, and handle security.</p><p><strong>3. App Store Connect:</strong> The “Storefront.” Where you write your app description, set the price, and upload screenshots.</p><p><strong>4. Create an App ID:</strong> In the Developer Console, go to <strong>Identifiers</strong> and create a new App ID. Use a “Reverse Domain” format like com.yourcompany.appname.</p><p><strong>5. Add Certificates:</strong> In Xcode, go to <strong>Settings &gt; Accounts</strong>, add your Apple ID, and click <strong>Manage Certificates</strong>. Hit the <strong>+</strong> and choose <strong>Apple Distribution</strong>. This tells Apple, “Yes, it’s really me sending this app.”</p><h3>📱 Step 3: Preparing the Flutter Project</h3><p>Go back to your code. We need to make sure the app knows its own name and version.</p><ol><li><strong>The Version Number:</strong> Open pubspec.yaml.</li></ol><pre>version: 1.0.0+1</pre><ul><li>1.0.0 is the <strong>Version Name</strong> (what users see).</li><li>1 is the <strong>Build Number</strong> (an internal integer).</li><li><strong>Crucial Rule:</strong> Every time you upload a new build to Apple, you <em>must</em> increase the build number (e.g., 1.0.0+2), even if the version name stays the same.</li></ul><p><strong>2. Clean it up:</strong> Open your terminal in the project root and run:</p><pre>flutter clean <br>flutter pub get</pre><h3>🛠 Step 4: The Xcode Magic</h3><p>Open the iOS folder of your project: open ios/Runner.xcworkspace.</p><ol><li><strong>General Tab:</strong> Set your <strong>Display Name</strong> (what shows under the icon on a phone).</li><li><strong>Signing &amp; Capabilities:</strong> * Select your <strong>Team</strong>.</li><li>Ensure <strong>Bundle Identifier</strong> matches your App ID from Step 2.</li><li><strong>Deployment Info:</strong> Check the box for <strong>iPhone</strong>. If you don’t want an iPad version, <strong>uncheck iPad</strong>. This saves you from having to provide iPad-specific screenshots later!</li></ol><h3>📦 Step 5: Building and Archiving via Xcode</h3><p>Instead of just running a command and hoping for the best, we are going to use <strong>Xcode’s Organizer</strong>. This is the professional way to do it because Xcode does a lot of the heavy lifting (like checking for errors) before you even hit “Upload.”</p><h3>Why use Xcode’s Organizer?</h3><ul><li><strong>Built-in Validation:</strong> Xcode checks your app for common mistakes (like missing icons) before uploading.</li><li><strong>Crash Symbolication:</strong> It automatically generates and uploads <strong>dSYMs</strong>. This is a fancy way of saying if your app crashes in the real world, Xcode can show you exactly which line of code broke.</li><li><strong>History:</strong> It keeps a record of every version you’ve ever uploaded in one window.</li></ul><h3>The Steps:</h3><ol><li><strong>Prepare for Archive:</strong> In the top toolbar of Xcode, next to the “Play” button, click the device selector and choose <strong>Any iOS Device (arm64)</strong>. You can’t archive if a Simulator is selected!</li><li><strong>Archive:</strong> Go to the top menu and select <strong>Product &gt; Archive</strong>.</li><li><strong>Wait for the Magic:</strong> Xcode will now compile your entire app. Once it’s done, the <strong>Organizer</strong> window will automatically pop up.</li><li><strong>Validate:</strong> Before you distribute, click <strong>Validate App</strong> on the right. If it passes, you’re golden.</li><li><strong>Distribute:</strong> Click <strong>Distribute App</strong>.</li><li>Choose <strong>App Store Connect</strong>.</li><li>Choose <strong>Upload</strong>.</li><li>Keep the default checkboxes (especially “Include bitcode” and “Upload symbols”).</li><li>Xcode will now talk to Apple’s servers and upload your binary.</li></ol><h3>🧪 Step 6: Assigning Test Customers (TestFlight)</h3><p>Before the world sees it, let’s show your friends.</p><ol><li>Go to <a href="https://appstoreconnect.apple.com/">App Store Connect</a> &gt; <strong>TestFlight</strong>.</li><li><strong>Internal Testing:</strong> Click the <strong>+</strong> next to “Internal Testing,” name the group “Team,” and add yourself.</li><li><strong>External Testing:</strong> If you want to send it to clients, create an “External Group.” Apple will briefly review the app before external testers can see it.</li><li>Once the build status says “Ready to Test,” download the <strong>TestFlight</strong> app on your iPhone to install your app.</li></ol><h3>🚀 Step 7: The Final Submission</h3><ol><li>In App Store Connect, go to the <strong>App Store</strong> tab.</li><li><strong>App Information:</strong> Select your category (e.g., “Utilities” or “Education”).</li><li><strong>Pricing &amp; Availability:</strong> Choose “Free” or set your price.</li><li><strong>Privacy Policy:</strong> You <em>must</em> provide a URL to a privacy policy. (There are free generators online for this!).</li><li><strong>Select the Build:</strong> Scroll down to the “Build” section, click the <strong>+</strong>, and select the version you uploaded.</li><li><strong>Submit for Review:</strong> Click the <strong>Add for Review</strong> button.</li></ol><blockquote><em>[!NOTE] </em><strong><em>The Review Process:</em></strong><em> A real person at Apple will open your app and test it. It usually takes 24–48 hours. If they “Reject” it, don’t worry! They’ll tell you exactly what’s wrong. Fix it, bump the build number in </em><em>pubspec.yaml, and upload again.</em></blockquote><h3>🎉 Conclusion</h3><p>You did it! You’ve gone from a local folder to a global platform. Deployment is a skill — the second time you do this, it’ll feel like second nature.</p><p><strong>Happy Fluttering! 💙</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9b096dd5f8d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Dark Mode: The Clean & Simple Guide (Using Provider)]]></title>
            <link>https://medium.com/@adilcholas/flutter-dark-mode-the-clean-simple-guide-using-provider-00f7cc0bef2d?source=rss-868d88120431------2</link>
            <guid isPermaLink="false">https://medium.com/p/00f7cc0bef2d</guid>
            <dc:creator><![CDATA[Adil Cholas]]></dc:creator>
            <pubDate>Fri, 23 Jan 2026 18:36:13 GMT</pubDate>
            <atom:updated>2026-01-23T18:36:13.087Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Zn334wO62naInXFiTkocw.png" /></figure><p>Dark mode isn’t just a stylistic choice anymore; it’s a user expectation. Whether it’s to save battery life on OLED screens or just to reduce eye strain late at night, your app needs to handle theme switching gracefully.</p><p>In this guide, we’re going to build a robust theme toggling mechanism in Flutter using the <strong>Provider</strong> package. We won’t just copy-paste code; we’ll understand <em>why</em> we are structuring it this way.</p><p>By the end of this article, you’ll have a fully functional app that toggles between a custom “Bumblebee Yellow” light theme and a sleek dark mode.</p><h3>What We Are Building</h3><p>We will create a system with three main parts:</p><ol><li><strong>The Look:</strong> Defining our Light and Dark ThemeData.</li><li><strong>The Brain:</strong> A ThemeProvider to manage the state.</li><li><strong>The Body:</strong> The UI that reacts to theme changes.</li></ol><h3>Step 1: Defining the “Look” (ThemeData)</h3><p>First, let’s stop hardcoding colors into our widgets. A professional Flutter developer defines styles centrally. Create a file named theme_data.dart.</p><p>We are using Material3, and for this example, we are creating a high-contrast Yellow/Black theme.</p><pre>import &#39;package:flutter/material.dart&#39;;<br><br>// ☀️ LIGHT THEME<br>ThemeData lightTheme = ThemeData(<br>  useMaterial3: true,<br>  colorScheme: ColorScheme.fromSeed(<br>    seedColor: const Color(0xFFFFDE3F), // Our Hero Yellow<br>    primary: const Color(0xFFFFDE3F),<br>    onPrimary: Colors.black, // Text on yellow should be black<br>    surface: const Color(0xFFFFFDF5), // Warm off-white background<br>  ),<br>  <br>  // Clean AppBar with no shadow<br>  appBarTheme: const AppBarTheme(<br>    backgroundColor: Color(0xFFFFDE3F),<br>    foregroundColor: Colors.black,<br>    elevation: 0,<br>  ),<br>  <br>  // Consistent Button Styling<br>  elevatedButtonTheme: ElevatedButtonThemeData(<br>    style: ElevatedButton.styleFrom(<br>      backgroundColor: const Color(0xFFFFDE3F),<br>      foregroundColor: Colors.black,<br>      textStyle: const TextStyle(fontWeight: FontWeight.bold),<br>    ),<br>  ),<br>);<br>// 🌙 DARK THEME<br>ThemeData darkTheme = ThemeData(<br>  useMaterial3: true,<br>  brightness: Brightness.dark,<br>  colorScheme: const ColorScheme.dark(<br>    primary: Color(0xFFF2D024), // Slightly muted yellow for dark mode<br>    surface: Color(0xFF1C1B17), // Rich, warm dark grey<br>    onSurface: Color(0xFFE6E2D9), // Readable off-white text<br>  ),<br>  <br>  appBarTheme: const AppBarTheme(<br>    backgroundColor: Color(0xFF1C1B17),<br>    foregroundColor: Color(0xFFF2D024),<br>    elevation: 0,<br>  ),<br>);</pre><p><strong>Why this matters:</strong> Notice how we define cardTheme and elevatedButtonTheme here? This means every button in your app will automatically look consistent without you having to style them individually.</p><h3>Step 2: The “Brain” (The Provider)</h3><p>Now we need a way to tell the app which theme to use. We use a ChangeNotifier class. Think of this as a radio station that broadcasts &quot;Hey, the theme changed!&quot; to anyone listening.</p><p>Create theme_provider.dart:</p><p>Dart</p><pre>import &#39;package:flutter/material.dart&#39;;<br><br>class ThemeProvider with ChangeNotifier {<br>  bool isDarkMode = false;<br>  // A helper to get the actual ThemeMode enum<br>  ThemeMode get themeMode =&gt; isDarkMode ? ThemeMode.dark : ThemeMode.light;<br>  void toggleTheme() {<br>    isDarkMode = !isDarkMode;<br>    notifyListeners(); // 📢 This tells Flutter to rebuild widgets watching this!<br>  }<br>}</pre><p>This is the beauty of Provider: the logic is separated from the UI. The toggleTheme function flips the boolean and triggers a UI update.</p><h3>Step 3: Wiring It Up (Main)</h3><p>For the “Brain” (Provider) to work, it needs to be injected into the app tree. We do this in main.dart using ChangeNotifierProvider.</p><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:provider/provider.dart&#39;;<br>import &#39;theme_data.dart&#39;;<br>import &#39;theme_provider.dart&#39;;<br>import &#39;home_screen.dart&#39;;<br><br>void main() {<br>  runApp(<br>    // wrap the app in the provider so it&#39;s available everywhere<br>    ChangeNotifierProvider(<br>      create: (context) =&gt; ThemeProvider(),<br>      child: MainApp(),<br>    ),<br>  );<br>}<br>class MainApp extends StatelessWidget {<br>  const MainApp({super.key});<br>  @override<br>  Widget build(BuildContext context) {<br>    // Watch the provider for changes<br>    final themeProvider = context.watch&lt;ThemeProvider&gt;();<br>    return MaterialApp(<br>      debugShowCheckedModeBanner: false,<br>      theme: lightTheme,        // Our custom light theme<br>      darkTheme: darkTheme,      // Our custom dark theme<br>      themeMode: themeProvider.themeMode, // The magic switch<br>      home: HomeScreen(),<br>    );<br>  }<br>}</pre><p><strong>Crucial Detail:</strong> Notice context.watch&lt;ThemeProvider&gt;(). This line ensures that whenever notifyListeners() is called in our provider, MainApp rebuilds and switches the themeMode.</p><h3>Step 4: Building the UI</h3><p>Finally, let’s create a screen that allows the user to trigger the toggle.</p><p>In home_screen.dart:</p><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:provider/provider.dart&#39;;<br>import &#39;theme_provider.dart&#39;;<br><br>class HomeScreen extends StatelessWidget {<br>  const HomeScreen({super.key});<br>  @override<br>  Widget build(BuildContext context) {<br>    // Access the provider to read state and call functions<br>    final themeProvider = context.watch&lt;ThemeProvider&gt;();<br>    return Scaffold(<br>      appBar: AppBar(<br>        title: const Text(&quot;Custom Dark Mode&quot;),<br>        actions: [<br>          IconButton(<br>            onPressed: themeProvider.toggleTheme,<br>            icon: Icon(<br>              themeProvider.isDarkMode ? Icons.light_mode : Icons.dark_mode,<br>            ),<br>          ),<br>        ],<br>      ),<br>      body: Center(<br>        child: Column(<br>          mainAxisAlignment: MainAxisAlignment.center,<br>          children: [<br>            Icon(<br>              themeProvider.isDarkMode<br>                  ? Icons.dark_mode_outlined<br>                  : Icons.light_mode_outlined,<br>              size: 80,<br>            ),<br>            const SizedBox(height: 10),<br>            Text(<br>              themeProvider.isDarkMode<br>                  ? &quot;Dark Mode Enabled&quot;<br>                  : &quot;Light Mode Enabled&quot;,<br>              style: Theme.of(context).textTheme.headlineSmall,<br>            ),<br>            const SizedBox(height: 20),<br>            // This button automatically picks up styles from theme_data.dart!<br>            ElevatedButton(<br>              onPressed: () {}, <br>              child: const Text(&quot;Learn Flutter&quot;),<br>            ),<br>          ],<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><h3>The Result</h3><p>When you tap the moon/sun icon in the AppBar:</p><ul><li>toggleTheme() runs in the provider.</li><li>isDarkMode flips to true/false.</li><li>notifyListeners() fires.</li><li>MainApp rebuilds, passing the new ThemeMode to MaterialApp.</li><li>Flutter automatically animates the transition between your lightTheme and darkTheme colors.</li></ul><h3>Summary</h3><p>You’ve just implemented a scalable theme architecture. By separating your colors (theme_data.dart) from your logic (theme_provider.dart), your code remains clean, readable, and easy to maintain.</p><p>Happy Coding! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=00f7cc0bef2d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Authentication: A Clean Architecture Approach using Provider & Secure Storage]]></title>
            <link>https://medium.com/@adilcholas/flutter-authentication-a-clean-architecture-approach-using-provider-secure-storage-1fe371c8143b?source=rss-868d88120431------2</link>
            <guid isPermaLink="false">https://medium.com/p/1fe371c8143b</guid>
            <dc:creator><![CDATA[Adil Cholas]]></dc:creator>
            <pubDate>Wed, 21 Jan 2026 14:25:36 GMT</pubDate>
            <atom:updated>2026-01-21T14:25:36.323Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WJ_n912Asn2idBjDl05_hQ.png" /></figure><p><em>Building a production-ready login flow that keeps users logged in — even after they close the app.</em></p><p>One of the first hurdles every Flutter developer faces is Authentication. It’s not just about sending a username and password to a server; it’s about managing the “state” of the user.</p><ul><li><em>How do I update the UI when the login fails?</em></li><li><em>How do I keep the user logged in if they restart the app?</em></li><li><em>Where do I store the token securely?</em></li></ul><p>In this guide, we are going to build a robust authentication flow using <strong>Provider</strong> for state management and <strong>Flutter Secure Storage</strong> for persistence.</p><h3>The Tech Stack</h3><ul><li><strong>Provider:</strong> To separate our logic from our UI.</li><li><strong>HTTP:</strong> To communicate with our API.</li><li><strong>Flutter Secure Storage:</strong> To store the JWT token safely (never use SharedPreferences for sensitive data!).</li></ul><h3>Step 1: The Blueprint (Model)</h3><p>First, we need to define what our data looks like. When we send our credentials to the server, we expect a response containing an authentication token.</p><p>Here is our LoginModel. It acts as a translator, converting the raw JSON response from the server into a Dart object we can actually use.</p><pre>// auth_model.dart<br>import &#39;dart:convert&#39;;<br><br>LoginModel loginModelFromJson(String str) =&gt; LoginModel.fromJson(json.decode(str));<br>class LoginModel {<br>    final String token;<br>    LoginModel({required this.token});<br>    factory LoginModel.fromJson(Map&lt;String, dynamic&gt; json) =&gt; LoginModel(<br>        token: json[&quot;token&quot;],<br>    );<br>}</pre><h3>Step 2: Talking to the Server (Service)</h3><p>We want to keep our code clean, so we separate the API calls into their own file. The AuthService doesn&#39;t know about the UI; its only job is to knock on the server&#39;s door and ask for a token.</p><p>We are posting the user’s credentials to the fakestoreapi endpoint. If the server replies with a 201 (Created/Success), we parse the data and return the token.</p><pre>// auth_service.dart<br>import &#39;package:http/http.dart&#39; as http;<br>import &#39;package:login_using_mock/model/auth_model.dart&#39;;<br><br>class AuthService {<br>  static Future&lt;String?&gt; callLogin({<br>    required String username,<br>    required String password,<br>  }) async {<br>    final String url = &#39;https://fakestoreapi.com/auth/profile&#39;;<br>    var data = {&quot;username&quot;: username, &quot;password&quot;: password};<br>    final response = await http.post(Uri.parse(url), body: data);<br>    if (response.statusCode == 201) {<br>      final body = loginModelFromJson(response.body);<br>      return body.token;<br>    }<br>    return null;<br>  }<br>}</pre><h3>Step 3: The Brain of the App (Provider)</h3><p>This is where the magic happens. The AuthProvider manages the state for the entire application. It handles three critical tasks:</p><ul><li><strong>Login:</strong> Calls the service and updates the UI state (loading vs. not loading).</li><li><strong>Persistence:</strong> Saves the token to secure storage so the user stays logged in.</li><li><strong>Initialization:</strong> Checks for an existing token when the app starts.</li></ul><blockquote><strong><em>Pro Tip:</em></strong><em> Notice the </em><em>init() method. We call this immediately when the app launches to check if the user has been here before.</em></blockquote><p>Dart</p><pre>// auth_provider.dart<br>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:flutter_secure_storage/flutter_secure_storage.dart&#39;;<br>import &#39;package:login_using_mock/core/auth_service.dart&#39;;<br><br>class AuthProvider with ChangeNotifier {<br>  bool isLoading = false;<br>  String? token;<br>  bool isInitialized = false;<br>  final storage = FlutterSecureStorage();<br>  bool get isAuthenicated =&gt; token != null;<br>  // Check for existing token on app start<br>  Future&lt;void&gt; init() async {<br>    final storedToken = await storage.read(key: &#39;auth_token&#39;);<br>    if (storedToken != null) {<br>      token = storedToken;<br>    }<br>    isInitialized = true;<br>    notifyListeners();<br>  }<br>  // Handle Login Logic<br>  Future&lt;bool&gt; login({required String username, required String password}) async {<br>    isLoading = true;<br>    notifyListeners();<br>    final result = await AuthService.callLogin(username: username, password: password);<br>    isLoading = false;<br>    if (result == null) {<br>      notifyListeners();<br>      return false;<br>    }<br>    // Save token securely<br>    token = result;<br>    await storage.write(key: &#39;auth_token&#39;, value: token); <br>    notifyListeners();<br>    return true;<br>  }<br>  // Handle Logout<br>  Future&lt;void&gt; logout() async {<br>    await storage.delete(key: &#39;auth_token&#39;);<br>    token = null;<br>    notifyListeners();<br>  }<br>}</pre><h3>Step 4: Connecting the UI</h3><p>We don’t want to manually push and pop routes (e.g., Navigator.push). Instead, we want our app to be <strong>reactive</strong>.</p><p>In our main.dart, we listen to the AuthProvider. Based on the current state, the app decides which screen to show:</p><ul><li><strong>Splash Screen:</strong> While we are checking secure storage.</li><li><strong>Home Screen:</strong> If the user has a token.</li><li><strong>Login Screen:</strong> If the user is unauthenticated.</li></ul><pre>// main.dart<br>void main() {<br>  runApp(<br>    ChangeNotifierProvider(<br>      create: (_) =&gt; AuthProvider()..init(), // Initialize immediately<br>      child: MainApp(),<br>    ),<br>  );<br>}<br>class MainApp extends StatelessWidget {<br>  const MainApp({super.key});<br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      home: Consumer&lt;AuthProvider&gt;(<br>        builder: (context, authProvider, _) {<br>          // 1. Waiting for storage check<br>          if (!authProvider.isInitialized) {<br>            return SplashScreen();<br>          }<br>          // 2. Decide where to go<br>          return authProvider.isAuthenicated ? HomeScreen() : LoginScreen();<br>        },<br>      ),<br>    );<br>  }<br>}</pre><h3>Step 5: The Login Screen</h3><p>Finally, the LoginScreen is simple. It collects the input and calls authProvider.login(). By using await, we can determine if the login failed and show a SnackBar immediately.</p><p>Dart</p><pre>// login_screen.dart logic<br>ElevatedButton(<br>  onPressed: () async {<br>    // Trigger the provider<br>    bool success = await authProvider.login(<br>      username: _userNameController.text,<br>      password: _passwordController.text,<br>    );<br>// Provide feedback<br>    if (!success &amp;&amp; context.mounted) {<br>      ScaffoldMessenger.of(context).showSnackBar(<br>        SnackBar(content: Text(&#39;Login failed&#39;))<br>      );<br>    }<br>  },<br>  child: Text(&#39;Login&#39;),<br>)</pre><h3>Summary</h3><p>By structuring our app this way, we have achieved a few major wins:</p><ul><li><strong>Security:</strong> Tokens are stored in FlutterSecureStorage, not plain text.</li><li><strong>User Experience:</strong> Users don’t have to log in every time they open the app.</li><li><strong>Clean Code:</strong> The UI layer doesn’t know <em>how</em> login works; it just asks the Provider to do it.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1fe371c8143b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Complete Guide to Flutter Google Authentication]]></title>
            <link>https://medium.com/@adilcholas/the-complete-guide-to-flutter-google-authentication-a1749d8cdd50?source=rss-868d88120431------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1749d8cdd50</guid>
            <dc:creator><![CDATA[Adil Cholas]]></dc:creator>
            <pubDate>Thu, 08 Jan 2026 01:42:50 GMT</pubDate>
            <atom:updated>2026-01-08T01:43:57.284Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h1Ws_ykoqK4F866T5Df43g.png" /></figure><h3>A complete, step-by-step walkthrough for Android and iOS.</h3><p>If you have ever tried to implement Google Sign-In in Flutter, you know the pain. You follow the official documentation, you copy the code, you run the app, you click the button… and <strong>nothing happens</strong>. Or worse, you get a cryptic PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10, null).</p><p>Google Authentication is simple in theory but strict in practice. If you miss one configuration step — like a SHA-1 fingerprint or a URL scheme — it fails silently.</p><p>In this guide, we are going to build a robust authentication flow using firebase_auth and google_sign_in. We will cover the specific config steps that most tutorials skip.</p><h3>The Tech Stack</h3><ul><li><strong>Flutter SDK:</strong> Latest Stable</li><li><strong>Firebase Core:</strong> ^3.6.0</li><li><strong>Firebase Auth:</strong> ^5.3.1</li><li><strong>Google Sign In:</strong> ^6.2.1</li></ul><h3>Phase 1: The Firebase Console</h3><p>Before we touch the code, we need to set up the backend.</p><ol><li>Go to the <a href="https://console.firebase.google.com/">Firebase Console</a> and create a new project.</li><li>Navigate to <strong>Build &gt; Authentication</strong>.</li><li>Click <strong>Get Started</strong> and select the <strong>Sign-in method</strong> tab.</li><li>Select <strong>Google</strong>, toggle it to <strong>Enable</strong>, and (crucially) select your <strong>Project Support Email</strong>.</li><li>Click <strong>Save</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bHB8_BLwsALwnC7yjmDfCA.png" /></figure><h3>Phase 2: Platform Configuration (The Tricky Part)</h3><p>This is where 90% of implementations fail. We must configure Android and iOS separately so they can “talk” to the Google app on the device.</p><h3>🤖 Android Setup</h3><p>Android requires a digital “handshake” using a SHA-1 key.</p><ol><li><strong>Register App:</strong> In your Firebase Project Overview, click the <strong>Android</strong> icon.</li><li><strong>Package Name:</strong> Open your Flutter project’s android/app/build.gradle file. Find applicationId. It will look like com.example.yourapp. Paste this into Firebase.</li><li><strong>The SHA-1 Key (Mandatory):</strong></li></ol><ul><li>Open your terminal in the root of your Flutter project.</li><li>Run this command:</li><li><strong>Mac/Linux:</strong> cd android &amp;&amp; ./gradlew signingReport</li><li><strong>Windows:</strong> cd android then gradlew signingReport</li><li>Wait for the output. Look for Task :app:signingReport.</li><li>Find the <strong>SHA1</strong> fingerprint under the debug variant. Copy it.</li><li><strong>Finish:</strong> Paste the SHA-1 into Firebase and click Register.</li><li><strong>Config File:</strong> Download google-services.json and place it in your project at android/app/google-services.json.</li></ul><blockquote><strong><em>Note:</em></strong><em> If you publish to the Play Store later, you will need to add your “Release” SHA-1 key to Firebase as well.</em></blockquote><h3>🍎 iOS Setup</h3><ol><li><strong>Register App:</strong> Add an iOS app in Firebase using your Bundle ID (found in Xcode).</li><li><strong>Config File:</strong> Download GoogleService-Info.plist.</li><li><strong>Add to Xcode:</strong> Open ios/Runner.xcworkspace. Drag the .plist file into the Runner folder.</li></ol><ul><li><em>Critical:</em> Ensure the checkbox <strong>“Copy items if needed”</strong> is selected.</li></ul><p><strong>URL Schemes:</strong></p><ul><li>Open the GoogleService-Info.plist file inside Xcode and copy the REVERSED_CLIENT_ID.</li><li>Go to the <strong>Info</strong> tab of your Runner target.</li><li>Scroll to <strong>URL Types</strong>, click +, and paste the ID into <strong>URL Schemes</strong>.</li></ul><h3>Phase 3: The Implementation</h3><p>We will use a clean architecture approach: A dedicated <strong>Service</strong> for logic, and a <strong>Wrapper</strong> for UI.</p><h3>1. Dependencies</h3><p>Add these to your pubspec.yaml:</p><p>YAML</p><pre>dependencies:<br>  flutter:<br>    sdk: flutter<br>  firebase_core: ^3.6.0<br>  firebase_auth: ^5.3.1<br>  google_sign_in: ^6.2.1</pre><h3>2. The Auth Service</h3><p>Create a file named auth_service.dart. This separates your business logic from your UI.</p><pre>import &#39;package:firebase_auth/firebase_auth.dart&#39;;<br>import &#39;package:google_sign_in/google_sign_in.dart&#39;;<br>class AuthService {<br>  final FirebaseAuth _auth = FirebaseAuth.instance;<br>  final GoogleSignIn _googleSignIn = GoogleSignIn();<br>  Future&lt;User?&gt; signInWithGoogle() async {<br>    try {<br>      // 1. Trigger the native Google Sign-In flow<br>      final GoogleSignInAccount? googleUser = await _googleSignIn.signIn();<br>      <br>      if (googleUser == null) return null; // User canceled<br>      // 2. Fetch the auth details (tokens)<br>      final GoogleSignInAuthentication googleAuth = await googleUser.authentication;<br>      // 3. Create a new credential for Firebase<br>      final OAuthCredential credential = GoogleAuthProvider.credential(<br>        accessToken: googleAuth.accessToken,<br>        idToken: googleAuth.idToken,<br>      );<br>      // 4. Sign in to Firebase with the credential<br>      final UserCredential userCredential = await _auth.signInWithCredential(credential);<br>      <br>      return userCredential.user;<br>    } catch (e) {<br>      print(&quot;Error signing in: $e&quot;);<br>      return null;<br>    }<br>  }<br>  Future&lt;void&gt; signOut() async {<br>    await _googleSignIn.signOut();<br>    await _auth.signOut();<br>  }<br>}</pre><h3>3. The UI &amp; Auth Wrapper</h3><p>In main.dart, we use a StreamBuilder. This is the &quot;Gatekeeper.&quot; It listens to Firebase; if the user is logged in, it shows the Home Screen. If not, it shows the Login Screen.</p><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:firebase_core/firebase_core.dart&#39;;<br>import &#39;package:firebase_auth/firebase_auth.dart&#39;;<br>import &#39;auth_service.dart&#39;;<br>void main() async {<br>  WidgetsFlutterBinding.ensureInitialized();<br>  await Firebase.initializeApp();<br>  runApp(const MyApp());<br>}<br>class MyApp extends StatelessWidget {<br>  const MyApp({super.key});<br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      home: const AuthWrapper(),<br>    );<br>  }<br>}<br>class AuthWrapper extends StatelessWidget {<br>  const AuthWrapper({super.key});<br>  @override<br>  Widget build(BuildContext context) {<br>    return StreamBuilder&lt;User?&gt;(<br>      stream: FirebaseAuth.instance.authStateChanges(),<br>      builder: (context, snapshot) {<br>        if (snapshot.connectionState == ConnectionState.waiting) {<br>          return const Center(child: CircularProgressIndicator());<br>        } else if (snapshot.hasData) {<br>          return const HomeScreen();<br>        } else {<br>          return const LoginScreen();<br>        }<br>      },<br>    );<br>  }<br>}</pre><p>Finally, let’s build the two simple screens:</p><pre>class LoginScreen extends StatelessWidget {<br>  const LoginScreen({super.key});@override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      body: Center(<br>        child: ElevatedButton.icon(<br>          icon: const Icon(Icons.login),<br>          label: const Text(&quot;Sign in with Google&quot;),<br>          onPressed: () async {<br>            await AuthService().signInWithGoogle();<br>          },<br>        ),<br>      ),<br>    );<br>  }<br>}<br>class HomeScreen extends StatelessWidget {<br>  const HomeScreen({super.key});<br>  @override<br>  Widget build(BuildContext context) {<br>    final user = FirebaseAuth.instance.currentUser;<br>    return Scaffold(<br>      appBar: AppBar(title: const Text(&quot;Dashboard&quot;)),<br>      body: Center(<br>        child: Column(<br>          mainAxisAlignment: MainAxisAlignment.center,<br>          children: [<br>            if (user?.photoURL != null)<br>              CircleAvatar(backgroundImage: NetworkImage(user!.photoURL!)),<br>            const SizedBox(height: 10),<br>            Text(&quot;Hello, ${user?.displayName}&quot;),<br>            TextButton(<br>              onPressed: () =&gt; AuthService().signOut(),<br>              child: const Text(&quot;Logout&quot;),<br>            )<br>          ],<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><h3>Troubleshooting: Why is it failing?</h3><p>Even with the code above, you might hit errors. Here are the common fixes:</p><p><strong>1. PlatformException(sign_in_failed, ApiException: 10)</strong> This is almost always a <strong>SHA-1</strong> issue.</p><ul><li><strong>Fix:</strong> You either didn’t add the SHA-1 key to the Firebase console, or you added the wrong one (Release vs Debug). Run gradlew signingReport again and double-check.</li></ul><p><strong>2. App crashes on iOS startup</strong></p><ul><li><strong>Fix:</strong> Ensure GoogleService-Info.plist is in the ios/Runner folder (not the root ios folder) and that you added the URL Scheme to Info.plist.</li></ul><p><strong>3. Works on Emulator but not on Real Device</strong></p><ul><li><strong>Fix:</strong> If you are building an APK (flutter run --release), you need to generate a <strong>Release SHA-1</strong> key from your keystore file and add that to Firebase as well. The debug SHA-1 only works for debug builds.</li></ul><h3>Conclusion</h3><p>Setting up Google Auth feels complicated the first time, but once you understand the relationship between the SHA-1 keys, the plist files, and the Flutter code, it becomes second nature.</p><p>By following this structure, you ensure a scalable authentication flow that handles user sessions automatically.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1749d8cdd50" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google Sign-In Play Store Fix: Complete Learning Guide]]></title>
            <link>https://medium.com/@adilcholas/google-sign-in-play-store-fix-complete-learning-guide-fb67bdf7df9e?source=rss-868d88120431------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb67bdf7df9e</guid>
            <dc:creator><![CDATA[Adil Cholas]]></dc:creator>
            <pubDate>Tue, 06 Jan 2026 11:06:40 GMT</pubDate>
            <atom:updated>2026-01-08T06:12:58.717Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b1LLiZNdRwY7ptHSg4nUWA.png" /></figure><h3>The Problem</h3><p>Your Google Sign-In works perfectly during development but fails when users download your app from the Play Store. This is one of the most common Android authentication issues.</p><h3>Why This Happens</h3><h3>Understanding App Signing</h3><p>When you build an Android app, it must be digitally signed with a certificate. Think of this certificate as a unique fingerprint that identifies your app.</p><p><strong>Two Different Signatures:</strong></p><ol><li><strong>Development/Upload Key</strong> — Used when you build locally on your computer</li><li><strong>Play Store App Signing Key</strong> — Google’s key that replaces yours after upload</li></ol><h3>The Authentication Flow</h3><p>Google Sign-In verifies requests using SHA-1 fingerprints:</p><pre>User clicks &quot;Sign in with Google&quot;<br>    ↓<br>App sends request with SHA-1 fingerprint<br>    ↓<br>Google checks: &quot;Is this SHA-1 authorized?&quot;<br>    ↓<br>✅ Match = Success | ❌ No Match = Error 10 or 12500</pre><p><strong>The Issue:</strong> Firebase only knows about your development key, not Google’s Play Store key.</p><h3>The Complete Fix</h3><h3>Step 1: Obtain the Play Store SHA-1</h3><ol><li>Open <a href="https://play.google.com/console">Google Play Console</a></li><li>Select your app from the dashboard</li><li>Navigate to: <strong>Release → Setup → App signing</strong> (or <strong>App Integrity</strong> in newer versions)</li><li>Locate the <strong>“App signing key certificate”</strong> section (top section) ⚠️ <strong>Critical:</strong> Do NOT use the “Upload key certificate” — this won’t work!</li><li>Copy the <strong>SHA-1 certificate fingerprint</strong></li></ol><ul><li>It looks like: AB:CD:EF:12:34:56:78:90:AB:CD:EF:12:34:56:78:90:AB:CD:EF:12</li></ul><h3>Step 2: Add SHA-1 to Firebase</h3><ol><li>Go to <a href="https://console.firebase.google.com/">Firebase Console</a></li><li>Select your project</li><li>Click the <strong>gear icon</strong> (⚙️) → <strong>Project settings</strong></li><li>Scroll to <strong>“Your apps”</strong> section</li><li>Click on your Android app</li><li>Click <strong>“Add fingerprint”</strong> button</li><li>Paste the SHA-1 from Play Console</li><li>Click <strong>Save</strong></li></ol><h3>Step 3: Wait and Test</h3><p><strong>Propagation Time:</strong> 5–10 minutes for Google’s servers to sync</p><p><strong>Testing:</strong></p><ul><li>No new app version needed</li><li>Open the existing Play Store version</li><li>Try signing in again</li></ul><h3>Understanding the Error Codes</h3><p>Error CodeMeaningCause<strong>10</strong>Developer ErrorSHA-1 fingerprint not whitelisted<strong>12500</strong>Sign-In ErrorConfiguration mismatch</p><h3>How to Check Logs</h3><p><strong>Using Android Studio:</strong></p><p>bash</p><pre>adb logcat | grep &quot;ApiException&quot;</pre><p><strong>Look for:</strong></p><pre>com.google.android.gms.common.api.ApiException: 10</pre><h3>Technical Deep Dive</h3><h3>What is SHA-1?</h3><p>SHA-1 (Secure Hash Algorithm 1) is a cryptographic hash function that creates a unique 40-character fingerprint from your app’s signing certificate.</p><p><strong>Example:</strong></p><pre>Certificate → SHA-1 Algorithm → AB:CD:EF:12:...:EF:12</pre><h3>OAuth2 Client ID Creation</h3><p>Google uses your SHA-1 + package name to generate an OAuth2 Client ID:</p><pre>SHA-1: AB:CD:EF:12:34:...<br>Package: com.example.myapp<br>    ↓<br>OAuth2 Client ID: 123456789-abcdefg.apps.googleusercontent.com</pre><h3>Why Play Store Changes the Signature</h3><p><strong>Security Benefits:</strong></p><ul><li>Google keeps the signing key secure</li><li>You can’t lose or leak the production key</li><li>Enables Play App Signing features</li><li>Allows key rotation if compromised</li></ul><h3>Multiple Environments Setup</h3><p>For a complete production app, you should have multiple SHA-1 fingerprints:</p><h3>Development Setup</h3><pre>✓ Debug keystore SHA-1      (for local testing)<br>✓ Upload key SHA-1          (for internal testing)<br>✓ Play Store signing SHA-1  (for production)</pre><h3>How to Get Each SHA-1</h3><p><strong>Debug Key (Development):</strong></p><p>bash</p><pre>keytool -list -v -keystore ~/.android/debug.keystore \<br>  -alias androiddebugkey -storepass android -keypass android</pre><p><strong>Upload Key (Your Release Key):</strong></p><p>bash</p><pre>keytool -list -v -keystore /path/to/your-keystore.jks \<br>  -alias your-key-alias</pre><p><strong>Play Store Key:</strong></p><ul><li>From Play Console (as described in Step 1)</li></ul><h3>Backend Configuration (Beyond Firebase)</h3><p>If you’re using Google Sign-In with a custom backend, you also need to configure Google Cloud Console:</p><h3>Step-by-Step</h3><ol><li>Go to <a href="https://console.cloud.google.com/">Google Cloud Console</a></li><li>Select your project</li><li>Navigate to: <strong>APIs &amp; Services → Credentials</strong></li><li>Find your <strong>OAuth 2.0 Client ID</strong> for Android</li><li>Add the Play Store SHA-1 to the <strong>“Signing-certificate fingerprint”</strong> field</li><li>Save changes</li></ol><h3>Troubleshooting Checklist</h3><ul><li>Used <strong>App signing key</strong> (not Upload key)</li><li>Added SHA-1 to correct Firebase project</li><li>Added SHA-1 to correct Android app in Firebase</li><li>Waited 10 minutes for propagation</li><li>Package name matches exactly in Firebase and app</li><li>google-services.json is up to date</li><li>Tested on device (not emulator if using Play Store build)</li><li>Checked for typos in SHA-1 fingerprint</li></ul><h3>Common Mistakes</h3><h4>❌ Wrong Certificate</h4><p>Using the “Upload key certificate” instead of “App signing key certificate”</p><h4>❌ Wrong Firebase Project</h4><p>Adding SHA-1 to a different Firebase project</p><h4>❌ Wrong App</h4><p>Adding SHA-1 to iOS app instead of Android app in Firebase</p><h4>❌ Not Waiting</h4><p>Testing immediately without waiting for propagation</p><h4>❌ Wrong Build Type</h4><p>Testing debug build when SHA-1 is only added for release</p><h3>Advanced: Multiple Package Names</h3><p>If you have multiple flavors (e.g., free/pro versions):</p><p>gradle</p><pre>android {<br>    productFlavors {<br>        free {<br>            applicationId &quot;com.example.app.free&quot;<br>        }<br>        pro {<br>            applicationId &quot;com.example.app.pro&quot;<br>        }<br>    }<br>}</pre><p><strong>You need separate Firebase apps for each:</strong></p><ul><li>Register both package names in Firebase</li><li>Add Play Store SHA-1 to both apps</li><li>Download separate google-services.json files</li></ul><h3>Testing Strategy</h3><h3>Before Release</h3><ol><li>Build release APK locally</li><li>Install on test device</li><li>Test Google Sign-In</li><li>Upload to Internal Testing track</li><li>Test again with Play Store version</li></ol><h3>After Release</h3><ol><li>Wait 10 minutes after adding SHA-1</li><li>Clear app data on test device</li><li>Update/reinstall from Play Store</li><li>Test sign-in flow</li><li>Monitor Crashlytics for ApiException errors</li></ol><h3>Prevention for Future Apps</h3><p>Create a checklist for every new app:</p><ol><li>Enable Play App Signing during first upload</li><li>Immediately grab App Signing SHA-1</li><li>Add to Firebase before first production release</li><li>Add to Google Cloud Console if using backend</li><li>Document all SHA-1 fingerprints for the project</li></ol><h3>Summary</h3><p><strong>The Root Cause:</strong> Google Play App Signing replaces your certificate, creating a new SHA-1 fingerprint that Google Sign-In doesn’t recognize.</p><p><strong>The Solution:</strong> Whitelist the Play Store’s SHA-1 in Firebase Console.</p><p><strong>Key Insight:</strong> This is purely a configuration issue — no code changes are needed.</p><p><strong>Time to Fix:</strong> 2 minutes to add + 10 minutes propagation = Problem solved.</p><h3>Additional Resources</h3><ul><li><a href="https://support.google.com/googleplay/android-developer/answer/9842756">Google Play App Signing Documentation</a></li><li><a href="https://firebase.google.com/docs/android/setup">Firebase Android Setup Guide</a></li><li><a href="https://developers.google.com/identity/sign-in/android">Google Sign-In for Android</a></li></ul><p><strong>Remember:</strong> Every time you see “ApiException: 10” with Google Sign-In on Play Store builds, check your SHA-1 fingerprints first. It’s almost always the solution.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb67bdf7df9e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Google Maps in Flutter ️️️]]></title>
            <link>https://medium.com/@adilcholas/mastering-google-maps-in-flutter-%EF%B8%8F%EF%B8%8F-%EF%B8%8F-c14be526945a?source=rss-868d88120431------2</link>
            <guid isPermaLink="false">https://medium.com/p/c14be526945a</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[provider]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[google-maps]]></category>
            <dc:creator><![CDATA[Adil Cholas]]></dc:creator>
            <pubDate>Sun, 04 Jan 2026 16:50:18 GMT</pubDate>
            <atom:updated>2026-01-04T17:06:29.944Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_c3C44gu-SnoowmprhpN6w.png" /></figure><p><strong>Objective:</strong> By the end of this guide, you will have a Flutter app that displays a Google Map, tracks the user’s location, and draws markers and routes (polylines).</p><h3>Phase 1: The Google Cloud Console (Prerequisites)</h3><p>Before writing code, we must get the “keys” to the engine. Google Maps is not free for unlimited use; you must set up a billing account (though there is a generous free tier).</p><ol><li><strong>Go to Console:</strong> Visit the <a href="https://console.cloud.google.com/">Google Cloud Console</a>.</li><li><strong>Create Project:</strong> Create a new project (e.g., FlutterMapsDemo).</li><li><strong>Enable APIs:</strong></li></ol><ul><li>Go to <strong>APIs &amp; Services &gt; Library</strong>.</li><li>Search for and enable <strong>Maps SDK for Android</strong> and <strong>Maps SDK for iOS</strong>.</li></ul><p>4. <strong>Get API Key:</strong></p><ul><li>Go to <strong>APIs &amp; Services &gt; Credentials</strong>.</li><li>Click <strong>Create Credentials &gt; API Key</strong>.</li><li><strong>Copy this key.</strong></li></ul><h3>Phase 2: Project Configuration</h3><p>We need to tell the Android and iOS platforms about our API key.</p><h3>1. Add Dependencies</h3><p>Open pubspec.yaml and add the following:</p><p>YAML</p><pre>dependencies:<br>  flutter:<br>    sdk: flutter<br>  google_maps_flutter: ^2.10.0 # Check pub.dev for the latest version<br>  geolocator: ^13.0.0 # For requesting location permissions</pre><h3>2. Android Setup</h3><ul><li>Open android/app/src/main/AndroidManifest.xml.</li><li>Add the following metadata tag inside the &lt;application&gt; tag (replace YOUR_API_KEY):</li></ul><p>XML</p><pre>&lt;manifest ...&gt;<br>    &lt;uses-permission android:name=&quot;android.permission.ACCESS_FINE_LOCATION&quot;/&gt;<br>    &lt;uses-permission android:name=&quot;android.permission.ACCESS_COARSE_LOCATION&quot;/&gt;</pre><pre>    &lt;application ...&gt;<br>        &lt;meta-data<br>            android:name=&quot;com.google.android.geo.API_KEY&quot;<br>            android:value=&quot;YOUR_API_KEY_HERE&quot;/&gt;<br>    &lt;/application&gt;<br>&lt;/manifest&gt;</pre><ul><li><strong>Min SDK Version:</strong> Ensure minSdkVersion in android/app/build.gradle is at least <strong>20</strong> (21 is recommended).</li></ul><h3>3. iOS Setup</h3><ul><li>Open ios/Runner/AppDelegate.swift.</li><li>Import GoogleMaps and provide the API key:</li></ul><pre>import UIKit<br>import Flutter<br>import GoogleMaps // 1. Add this import<br><br>@main<br>@objc class AppDelegate: FlutterAppDelegate {<br>  override func application(<br>    _ application: UIApplication,<br>    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?<br>  ) -&gt; Bool {<br>    GMSServices.provideAPIKey(&quot;YOUR_API_KEY_HERE&quot;) <br>    // 2. Add this line<br>    GeneratedPluginRegistrant.register(with: self)<br>    return super.application(application, didFinishLaunchingWithOptions: launchOptions)<br>  }<br>}</pre><ul><li>Open ios/Runner/Info.plist and add permission descriptions:</li></ul><pre>&lt;key&gt;NSLocationWhenInUseUsageDescription&lt;/key&gt;<br>&lt;string&gt;We need your location to show it on the map.&lt;/string&gt;</pre><h3>Phase 3: Implementation (The Code)</h3><p>We will build a screen that loads the map, asks for permission, shows the “Blue Dot” (User Location), and adds visual elements.</p><h3>Step 1: The Basic Map Widget</h3><p>Create a file map_screen.dart.</p><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:google_maps_flutter/google_maps_flutter.dart&#39;;<br>import &#39;package:geolocator/geolocator.dart&#39;; // For permissions<br><br>class MapScreen extends StatefulWidget {<br>  const MapScreen({super.key});<br>  @override<br>  State&lt;MapScreen&gt; createState() =&gt; _MapScreenState();<br>}<br>class _MapScreenState extends State&lt;MapScreen&gt; {<br>  // Controller to manipulate map programmatically (zoom, move)<br>  late GoogleMapController mapController;<br>  // Starting position (CUSAT, Kochi example)<br>  final LatLng _center = const LatLng(10.0430, 76.3242);<br>  void _onMapCreated(GoogleMapController controller) {<br>    mapController = controller;<br>  }<br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      appBar: AppBar(title: const Text(&#39;Flutter Maps Workshop&#39;)),<br>      body: GoogleMap(<br>        onMapCreated: _onMapCreated,<br>        initialCameraPosition: CameraPosition(<br>          target: _center,<br>          zoom: 14.0,<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><h3>Step 2: Displaying User’s Location</h3><p>To show the blue dot, we need to set myLocationEnabled: true on the GoogleMap widget. However, this <strong>only works if the user grants permission</strong>.</p><p>Add this method to _MapScreenState and call it in initState:</p><pre>@override<br>  void initState() {<br>    super.initState();<br>    _checkLocationPermissions();<br>  }<br><br>Future&lt;void&gt; _checkLocationPermissions() async {<br>    bool serviceEnabled;<br>    LocationPermission permission;<br>    // Check if location services are enabled<br>    serviceEnabled = await Geolocator.isLocationServiceEnabled();<br>    if (!serviceEnabled) {<br>      // Location services are not enabled don&#39;t continue<br>      return;<br>    }<br>    permission = await Geolocator.checkPermission();<br>    if (permission == LocationPermission.denied) {<br>      permission = await Geolocator.requestPermission();<br>      if (permission == LocationPermission.denied) {<br>        return; // Permissions are denied<br>      }<br>    }<br>    <br>    if (permission == LocationPermission.deniedForever) {<br>      return; // Permissions are denied forever<br>    }<br>    <br>    // If we reach here, permissions are granted.<br>    // Trigger a rebuild to enable the &quot;myLocation&quot; layer<br>    setState(() {}); <br>  }</pre><p>Now update the GoogleMap widget in build:</p><pre>body: GoogleMap(<br>        onMapCreated: _onMapCreated,<br>        initialCameraPosition: CameraPosition(target: _center, zoom: 14.0),<br>        myLocationEnabled: true, // Shows blue dot<br>        myLocationButtonEnabled: true, // Shows button to center on user<br>      ),</pre><h3>Step 3: Adding Markers &amp; Polylines</h3><p>We use Set&lt;Marker&gt; and Set&lt;Polyline&gt; to draw on the map.</p><ul><li><strong>Define the Data:</strong> Add these variables to your state class.</li></ul><pre>final Set&lt;Marker&gt; _markers = {};<br>  final Set&lt;Polyline&gt; _polylines = {};<br><br>// Example coordinates<br>  final LatLng _point1 = const LatLng(10.0430, 76.3242);<br>  final LatLng _point2 = const LatLng(10.0261, 76.3125);</pre><ul><li><strong>Create the Objects:</strong> Add this function to populate the map.</li></ul><pre>void _addMapObjects() {<br>    setState(() {<br>      // 1. Add Markers<br>      _markers.add(<br>        Marker(<br>          markerId: const MarkerId(&#39;origin&#39;),<br>          position: _point1,<br>          infoWindow: const InfoWindow(title: &#39;Start&#39;, snippet: &#39;CUSAT Campus&#39;),<br>          icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueGreen),<br>        ),<br>      );<br>      _markers.add(<br>        Marker(<br>          markerId: const MarkerId(&#39;destination&#39;),<br>          position: _point2,<br>          infoWindow: const InfoWindow(title: &#39;End&#39;, snippet: &#39;Lulu Mall&#39;),<br>          icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueRed),<br>        ),<br>      );<br>      // 2. Add Polyline (Line connecting the points)<br>      _polylines.add(<br>        Polyline(<br>          polylineId: const PolylineId(&#39;route1&#39;),<br>          points: [_point1, _point2],<br>          color: Colors.blue,<br>          width: 5,<br>        ),<br>      );<br>    });<br>  }</pre><ul><li><strong>Update the Widget:</strong> Pass these sets to the GoogleMap widget and call the function (e.g., in initState or via a FloatingActionButton).</li></ul><pre>body: GoogleMap(<br>        // ... existing properties<br>        markers: _markers,<br>        polylines: _polylines,<br>      ),<br>      floatingActionButton: FloatingActionButton(<br>        onPressed: _addMapObjects,<br>        child: const Icon(Icons.map),<br>      ),</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c14be526945a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>