<?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 Shivani Bagal on Medium]]></title>
        <description><![CDATA[Stories by Shivani Bagal on Medium]]></description>
        <link>https://medium.com/@shivanibagal88?source=rss-3574cdf35e31------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*4VmKraZaVlaxBu1b</url>
            <title>Stories by Shivani Bagal on Medium</title>
            <link>https://medium.com/@shivanibagal88?source=rss-3574cdf35e31------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 22:12:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shivanibagal88/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[Google Maps In Flutter — Markers, Camera, Polylines, And Everything In Between]]></title>
            <link>https://medium.com/@shivanibagal88/google-maps-in-flutter-markers-camera-polylines-and-everything-in-between-a20d2e902e3b?source=rss-3574cdf35e31------2</link>
            <guid isPermaLink="false">https://medium.com/p/a20d2e902e3b</guid>
            <category><![CDATA[flutter-google-map]]></category>
            <category><![CDATA[google-maps]]></category>
            <dc:creator><![CDATA[Shivani Bagal]]></dc:creator>
            <pubDate>Thu, 19 Nov 2026 03:55:42 GMT</pubDate>
            <atom:updated>2026-11-19T03:55:42.883Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*iqI3XawNdofxocZLMuI2VQ.png" /></figure><p>Maps look simple until you actually try to build one. You add a widget, it shows a grey box, and then you spend an hour finding out you forgot an API key in the wrong file.</p><p>I’ve been there. So this post goes step by step: setup, showing a map, placing markers, moving the camera, and drawing a route with a polyline. Every code block here follows the google_maps_flutter API, but test each snippet in your own project before you ship it, because Google Maps changes more often than most of us would like.</p><blockquote>What We’re Building</blockquote><p>By the end, you’ll have a map that:</p><ul><li>Shows a map centered on a location</li><li>Places markers and handles taps on them</li><li>Moves the camera when you press a button</li><li>Draws a line (a polyline) between two points</li></ul><p>Simple features, but they cover most of what a real app needs.</p><blockquote>Step 1 — Get An API Key</blockquote><p>Go to the Google Cloud Console, create a project, and create an API key. Then enable these APIs:</p><ul><li><strong>Maps SDK for Android</strong></li><li><strong>Maps SDK for iOS</strong></li></ul><p>If you skip the enabling step, the map loads blank or shows an error about the API key. The key itself is correct, but the API isn’t turned on. This one has caught me before.</p><blockquote>Step 2 — Add The Package</blockquote><pre>dependencies:<br>  google_maps_flutter: ^2.12.1</pre><p>Run flutter pub get. The version in your pubspec is in the 2.12 range, so keep it there unless you&#39;ve checked the changelog for a newer version.</p><blockquote>Step 3 — Android Setup</blockquote><p>Open android/app/src/main/AndroidManifest.xml and add the key inside the &lt;application&gt; tag:</p><pre>&lt;meta-data<br>    android:name=&quot;com.google.android.geo.API_KEY&quot;<br>    android:value=&quot;YOUR_ANDROID_API_KEY&quot;/&gt;</pre><p>Also make sure your minimum SDK is at least 21 in android/app/build.gradle.</p><p>For location features, add these permissions above the &lt;application&gt; tag:</p><pre>&lt;uses-permission android:name=&quot;android.permission.INTERNET&quot;/&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><blockquote>Step 4 — iOS Setup</blockquote><p>Open ios/Runner/AppDelegate.swift and provide the key before the app starts:</p><pre>import UIKit<br>import Flutter<br>import GoogleMaps</pre><pre>@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_IOS_API_KEY&quot;)<br>    GeneratedPluginRegistrant.register(with: self)<br>    return super.application(application, didFinishLaunchingWithOptions: launchOptions)<br>  }<br>}</pre><p>If you’re using a separate key for iOS, make sure the iOS key goes here and not the Android one. Mixing them up gives you a blank map with no clear error.</p><p>For location, add these to ios/Runner/Info.plist:</p><pre>&lt;key&gt;NSLocationWhenInUseUsageDescription&lt;/key&gt;<br>&lt;string&gt;We need your location to show you on the map&lt;/string&gt;</pre><p>Then run cd ios &amp;&amp; pod install.</p><blockquote>Step 5 — Show Your First Map</blockquote><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:google_maps_flutter/google_maps_flutter.dart&#39;;</pre><pre>class MapScreen extends StatefulWidget {<br>  const MapScreen({super.key});</pre><pre>  @override<br>  State&lt;MapScreen&gt; createState() =&gt; _MapScreenState();<br>}</pre><pre>class _MapScreenState extends State&lt;MapScreen&gt; {<br>  // Pune, because that&#39;s where I live<br>  static const LatLng _pune = LatLng(18.5204, 73.8567);</pre><pre>  GoogleMapController? _mapController;</pre><pre>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      appBar: AppBar(title: const Text(&#39;My Map&#39;)),<br>      body: GoogleMap(<br>        initialCameraPosition: const CameraPosition(<br>          target: _pune,<br>          zoom: 12,<br>        ),<br>        onMapCreated: (controller) {<br>          _mapController = controller;<br>        },<br>      ),<br>    );<br>  }<br>}</pre><p>Two things to remember:</p><p><strong>The map needs a bounded size.</strong> If you put GoogleMap inside a Column without Expanded, or inside a scrollable with no height, it either disappears or throws a layout error. Wrap it in Expanded or give it a SizedBox with a fixed height.</p><p><strong>onMapCreated gives you the controller.</strong> You use that controller to move the camera and do other map actions. Save it in a variable as shown above.</p><blockquote>Step 6 — Map Types</blockquote><p>The map can look different depending on what your app needs:</p><pre>GoogleMap(<br>  mapType: MapType.normal,      // Default road map<br>  // mapType: MapType.satellite, // Satellite imagery<br>  // mapType: MapType.hybrid,    // Satellite with labels<br>  // mapType: MapType.terrain,   // Terrain shading<br>  initialCameraPosition: const CameraPosition(target: _pune, zoom: 12),<br>)</pre><p>For most apps, normal is what users expect. Satellite and hybrid are useful for property, farming, or delivery apps where people need to see the actual ground.</p><blockquote>Step 7 — Add Markers</blockquote><p>A marker is a pin on the map. You create a Set&lt;Marker&gt; and pass it to the map.</p><pre>class _MapScreenState extends State&lt;MapScreen&gt; {<br>  static const LatLng _pune = LatLng(18.5204, 73.8567);<br><br>final Set&lt;Marker&gt; _markers = {};<br><br>@override<br>  void initState() {<br>    super.initState();<br><br><br>_markers.add(<br>      const Marker(<br>        markerId: MarkerId(&#39;office&#39;),<br>        position: LatLng(18.5204, 73.8567),<br>        infoWindow: InfoWindow(<br>          title: &#39;Office&#39;,<br>          snippet: &#39;Work hours 10am to 7pm&#39;,<br>        ),<br>      ),<br>    );<br><br>_markers.add(<br>      const Marker(<br>        markerId: MarkerId(&#39;cafe&#39;),<br>        position: LatLng(18.5314, 73.8446),<br>        infoWindow: InfoWindow(title: &#39;My favourite cafe&#39;),<br>      ),<br>    );<br>  }<br><br><br>@override<br>  Widget build(BuildContext context) {<br>    return GoogleMap(<br>      initialCameraPosition: const CameraPosition(target: _pune, zoom: 13),<br>      markers: _markers,<br>    );<br>  }<br>}</pre><p>Each marker needs a unique markerId. If two markers share the same ID, the second one overwrites the first. This is a common bug when markers come from a list and the IDs are generated carelessly.</p><blockquote>Handling Taps On Markers</blockquote><pre>Marker(<br>  markerId: MarkerId(place.id),<br>  position: LatLng(place.lat, place.lng),<br>  onTap: () {<br>    // Do something when this marker is tapped<br>    print(&#39;Tapped ${place.name}&#39;);<br>  },<br>)</pre><blockquote>Handling Taps On The Map</blockquote><pre>GoogleMap(<br>  initialCameraPosition: const CameraPosition(target: _pune, zoom: 13),<br>  onTap: (LatLng position) {<br>    // The user tapped an empty spot on the map<br>    print(&#39;Tapped at ${position.latitude}, ${position.longitude}&#39;);<br>  },<br>)</pre><p>This is handy when you want the user to drop a pin wherever they choose, like choosing a delivery address.</p><blockquote>Step 8 — Move The Camera</blockquote><p>The camera controls what part of the map the user sees. You can move it instantly or animate it.</p><pre>// Animate to a new location<br>Future&lt;void&gt; _goToCafe() async {<br>  await _mapController?.animateCamera(<br>    CameraUpdate.newCameraPosition(<br>      const CameraPosition(<br>        target: LatLng(18.5314, 73.8446),<br>        zoom: 16,<br>      ),<br>    ),<br>  );<br>}</pre><pre>// Fit several markers on screen at once<br>Future&lt;void&gt; _fitAllMarkers() async {<br>  final points = _markers.map((m) =&gt; m.position).toList();<br>  final bounds = LatLngBounds(<br>    southwest: LatLng(<br>      points.map((p) =&gt; p.latitude).reduce((a, b) =&gt; a &lt; b ? a : b),<br>      points.map((p) =&gt; p.longitude).reduce((a, b) =&gt; a &lt; b ? a : b),<br>    ),<br>    northeast: LatLng(<br>      points.map((p) =&gt; p.latitude).reduce((a, b) =&gt; a &gt; b ? a : b),<br>      points.map((p) =&gt; p.longitude).reduce((a, b) =&gt; a &gt; b ? a : b),<br>    ),<br>  );<br><br>await _mapController?.animateCamera(<br>    CameraUpdate.newLatLngBounds(bounds, 60), // 60 pixels of padding<br>  );<br>}</pre><p>animateCamera moves smoothly. moveCamera jumps instantly. Use animate for user actions like tapping a button, and move when you&#39;re setting up the initial view.</p><p>The bounds helper is slightly verbose, but it does exactly what you need: it makes sure every marker is visible.</p><blockquote>Step 9 — Draw A Polyline</blockquote><p>A polyline is a line connecting a list of points. It’s how you show a route, a path someone walked, or a boundary.</p><p>The simplest version is a straight line between points you already have:</p><pre>final Set&lt;Polyline&gt; _polylines = {};<br><br>void _drawLine() {<br>  final List&lt;LatLng&gt; points = [<br>    const LatLng(18.5204, 73.8567),<br>    const LatLng(18.5314, 73.8446),<br>    const LatLng(18.5590, 73.7868),<br>  ];<br>  _polylines.add(<br>    Polyline(<br>      polylineId: const PolylineId(&#39;my_route&#39;),<br>      points: points,<br>      color: Colors.blue,<br>      width: 5,<br>    ),<br>  );<br>  setState(() {});<br>}</pre><p>Then pass it to the map:</p><pre>GoogleMap(<br>  initialCameraPosition: const CameraPosition(target: _pune, zoom: 13),<br>  polylines: _polylines,<br>  markers: _markers,<br>)</pre><p>This draws straight lines between the points. Useful for a walking path you already know. But it won’t follow roads.</p><blockquote>Step 10 — Draw A Real Road Route</blockquote><p>For a route that follows roads, you need the Directions API. Your app asks Google for a route between two points, Google sends back an encoded path, and you decode it into points for the polyline.</p><p>This is the part that needs the most care, because you’re calling an API, and the package you use to decode the path has changed over time. Check the current flutter_polyline_points documentation before copying the code below, and make sure the Directions API is enabled in the same Google Cloud project.</p><pre>import &#39;package:flutter_polyline_points/flutter_polyline_points.dart&#39;;<br><br><br>Future&lt;void&gt; _drawRoadRoute(LatLng origin, LatLng destination) async {<br>  final polylinePoints = PolylinePoints(apiKey: &#39;YOUR_ANDROID_OR_WEB_API_KEY&#39;);<br>  final result = await polylinePoints.getRouteBetweenCoordinatesV2(<br>    request: RoutesApiRequest(<br>      origin: PointLatLng(origin.latitude, origin.longitude),<br>      destination: PointLatLng(destination.latitude, destination.longitude),<br>      travelMode: TravelMode.driving,<br>    ),<br>  );<br>  if (result.routes.isEmpty) {<br>    print(&#39;No route found&#39;);<br>    return;<br>  }<br>  final routePoints = result.routes.first.polylinePoints<br>      .map((p) =&gt; LatLng(p.latitude, p.longitude))<br>      .toList();<br>  setState(() {<br>    _polylines.clear();<br>    _polylines.add(<br>      Polyline(<br>        polylineId: const PolylineId(&#39;road_route&#39;),<br>        points: routePoints,<br>        color: Colors.blue,<br>        width: 5,<br>      ),<br>    );<br>  });<br>}</pre><p>A few things to note:</p><p><strong>Keep the API key on your backend if you can.</strong> Putting a Maps key inside a mobile app means anyone who decompiles your app can see it. Restrict the key in the Google Cloud Console to your app’s package name and SHA-1 fingerprint, and limit which APIs it can call.</p><p><strong>Check the method names against your installed version.</strong> The flutter_polyline_points API has changed across versions, and the names above match the newer Routes API style. If your version doesn&#39;t have getRouteBetweenCoordinatesV2, read the package&#39;s own README for the matching call.</p><blockquote>Things That Will Catch You Out</blockquote><p><strong>Blank grey map on Android</strong> — the API key isn’t in the manifest, or the Maps SDK for Android isn’t enabled. Check both.</p><p><strong>Map shows but tiles don’t load</strong> — usually billing isn’t enabled on the Google Cloud project. Google requires a billing account even for the free tier.</p><p><strong>Works on Android, blank on iOS</strong> — you used the Android key in AppDelegate.swift, or you forgot pod install.</p><p><strong>Layout error about unbounded height</strong> — GoogleMap is inside a widget that doesn&#39;t give it a size. Wrap it in Expanded or a SizedBox.</p><p><strong>Marker disappears when you add another</strong> — two markers have the same markerId. Make each ID unique.</p><p><strong>Polyline doesn’t show</strong> — the points list has fewer than two points, or the polyline is added to your set but you didn’t call setState.</p><p><strong>Camera doesn’t move</strong> — you’re calling the controller before onMapCreated has run. Check that _mapController isn&#39;t null.</p><h3>Quick Checklist</h3><ul><li>✅ Maps SDK for Android and iOS enabled in Google Cloud</li><li>✅ Billing enabled on the project</li><li>✅ Android key in AndroidManifest.xml</li><li>✅ iOS key in AppDelegate.swift</li><li>✅ GoogleMap inside a bounded-size widget</li><li>✅ Each marker has a unique markerId</li><li>✅ Directions API enabled if you draw road routes</li><li>✅ API key restricted to your app’s package and SHA-1</li><li>✅ Tested on a real device, not just the emulator</li></ul><p>Maps feel intimidating, but once you’ve set up the keys correctly, most of the work is just adding markers and moving the camera. The polyline part is where you need to slow down and check the current docs, because that’s where most of the surprises are.</p><p><em>— Shivani Bagal </em>🤍<em>,</em></p><p><em>who has spent more time than she’d like staring at a grey box that should have been a map</em></p><p><em>“Stuck on a Maps issue? Drop your error message in the comments with which platform it fails on. Most map problems come down to the API key or one of the enabled APIs.”</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a20d2e902e3b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Diwali Is Not Only For Families At Home. Here’s Why It Belongs To Everyone.]]></title>
            <link>https://medium.com/@shivanibagal88/diwali-is-not-only-for-families-at-home-heres-why-it-belongs-to-everyone-0119f3ba2dd5?source=rss-3574cdf35e31------2</link>
            <guid isPermaLink="false">https://medium.com/p/0119f3ba2dd5</guid>
            <category><![CDATA[diwali-celebration]]></category>
            <dc:creator><![CDATA[Shivani Bagal]]></dc:creator>
            <pubDate>Tue, 17 Nov 2026 03:46:56 GMT</pubDate>
            <atom:updated>2026-11-17T03:46:56.847Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*MS2OQIkKn5cMyDm4nbJz0w.png" /></figure><p>Every year, the same question comes up around Diwali. Did you make sweets at home? Did you do the full puja with the whole family? Were you at your parents’ place?</p><p>And every year I think the same thing. That’s one way to celebrate. It’s not the only way, and I don’t think it’s the point.</p><p>Diwali has become a huge festival. It was already big in India, but now people in other countries celebrate it too. Friends who have never been to India put up diyas, join Diwali parties, and ask what the festival is about. Cultures are mixing in a way that would have sounded strange a generation ago. And that’s a good thing.</p><p>So let’s talk about what Diwali is really for.</p><blockquote>The Real Purpose Is People Coming Together</blockquote><p>Strip away the sweets, the decorations, and the perfect Instagram photo of a lit-up balcony. What’s left?</p><p>People getting together. Having fun. Sharing memories. Making noise together, cleaning together, cooking together, laughing together.</p><p>Sweets are lovely. Family is lovely. But neither of them is the motive. The motive is that people should come together, and should have a reason to.</p><p>When I think about the best Diwali moments, they’re not about perfect decor or a perfect menu. They’re about a messy kitchen where five people are making food and nobody knows whose turn it is to wash the pan. They’re about a terrace full of crackers and laughter. A rangoli that somebody started, and everyone else finished, and it doesn’t look perfect, and that’s the best part.</p><blockquote>Work Together, Then Celebrate Together</blockquote><p>There’s a beautiful thing about festivals that gets lost. They are work, and they are fun, and they’re both at the same time.</p><p>Cleaning the house before Diwali is work. Making food is work. Setting up lights, arranging diyas, drawing rangoli on the floor until your back hurts is work. But when everyone does it together, the work becomes part of the celebration.</p><p>Then comes the fun. The lights come on. The crackers go up. The children run around with sparklers. The grown-ups stand around with tea and pretend they are not enjoying it as much as the kids.</p><p>That’s the part people remember. Not the cleaning. The laughter.</p><blockquote>For People Who Live Alone Or Far From Home</blockquote><p>This is the part I want to talk about most.</p><p>Not everyone gets to be home for Diwali. Some people are working in another city. Some are in a hostel or a PG. Some moved abroad for a job or a course. Some are living alone for the first time and the festival feels strange and quiet.</p><p>If you’re in that position, please don’t feel like you’re doing Diwali wrong.</p><p>You can still celebrate. Light a diya on your windowsill. Video call your family and show them the rangoli you made. Cook one dish you grew up with, even if it doesn’t turn out the same. Invite your friends who are also far from home. Diwali parties are often full of people who aren’t celebrating with their own families, and they’re some of the happiest people in the room.</p><p>The festival doesn’t belong only to the people who are physically with their families. It belongs to anyone who wants to be part of it.</p><blockquote>Make It Your Own Tradition</blockquote><p>Here’s an idea I really like.</p><p>What if your group of friends picked one trip every year, and made it the Diwali trip? Same people, same time, somewhere new or somewhere you love. After a few years, nobody has to ask what you’re doing for Diwali. You already know. You’re going to the hills, or the beach, or the same small guesthouse where the chai is terrible and everyone loves it anyway.</p><p>Traditions don’t need to be ancient to matter. Someone started every tradition you’ve ever loved. Someone decided that this is what we do, and then everyone else kept doing it.</p><p>So start one. Maybe the first year it’s a mess. Maybe the bus is late and the food runs out. But five years from now, when someone says “remember the Diwali trip with the power cut,” everybody will laugh.</p><blockquote>What Actually Matters</blockquote><p>Here’s what I believe after all of this.</p><p>People should get time off from their offices and their work. They should spend it with the people they care about, whether that’s family, friends, or a group of people who became family by showing up. It doesn’t matter if you celebrate at home, on a trip, in a rented flat, or in a crowded park with a stranger who becomes a friend.</p><p>What matters is the laughter on people’s faces. When everyone is tired and happy and sitting together on a floor covered in rangoli colour, and nobody is checking their phone.</p><p>That’s Diwali. That’s the whole point.</p><p><em>— Shivani Bagal </em>🤍<em>,</em></p><p><em>who has a rangoli stain on her carpet and absolutely no regrets</em></p><p><em>“How do you celebrate when you’re far from home, or when home is far from you? Drop it in the comments. I want to hear the stories.”</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0119f3ba2dd5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apparently AI Decided to Report a Murder to the Police]]></title>
            <link>https://medium.com/@shivanibagal88/apparently-ai-decided-to-report-a-murder-to-the-police-e4d566a0e7b6?source=rss-3574cdf35e31------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4d566a0e7b6</guid>
            <category><![CDATA[ai-error]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Shivani Bagal]]></dc:creator>
            <pubDate>Tue, 27 Oct 2026 09:56:04 GMT</pubDate>
            <atom:updated>2026-10-27T09:56:04.674Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*HsQGae15WI7KXZxDWbK04g.png" /></figure><p><strong>I thought AI agents were supposed to help us do boring things.</strong></p><p>Fill out the form.<br>Find the information.<br>Do the repetitive task I don’t want to do.</p><p>Apparently one AI agent decided to report a murder instead.</p><p>And no, nobody asked it to.</p><p>An Anthropic AI model called Claude Haiku 4.5 submitted a fake tip about an unsolved homicide to a Philadelphia police website during an internal test. The tip claimed the AI had information about the case and had seen someone matching the suspect’s description.</p><p>It hadn’t.</p><p>Obviously.</p><p>At this point, I don’t know whether to laugh or close my laptop.</p><blockquote><strong>Okay. What Actually Happened?</strong></blockquote><p>Anthropic was testing Claude by asking it to perform example tasks on randomly selected websites.</p><p>During one of those tests, Claude landed on a Philadelphia Police Department website where people can submit information about unsolved murders.</p><p>And then it filled out the form.</p><p>The message basically said that it might have information about the case and that it remembered seeing someone matching the description near the area.</p><p>The problem?</p><p>There was no person.</p><p>There was no memory.</p><p>There was just Claude confidently filling out a police tip form with information it had completely made up.</p><p>The interesting part is that Claude wasn’t explicitly told to submit the form.</p><p>In fact, it had been instructed not to log in, create accounts, enter personal information, make purchases, or submit anything destructive.</p><p>But the instructions didn’t specifically say:</p><p><strong>“Please don’t report imaginary murders to the police.”</strong></p><p>And apparently that gap was enough.</p><blockquote><strong>Luckily, It Didn’t Reach the Police</strong></blockquote><p>Here’s where this story could have become much worse.</p><p>The fake tip was flagged as spam, so it never reached the investigators responsible for reviewing homicide tips.</p><p>There was also no evidence that Claude hacked into the police system or accessed any police data. It simply interacted with a publicly available website.</p><p>So thankfully, nobody started an investigation based on an AI hallucination.</p><p>Imagine having to explain:</p><p>“Yeah, we have a new lead.”</p><p>“What’s the source?”</p><p>“Claude.”</p><p>I would simply leave the meeting.</p><p>The Philadelphia Police Department still considered the incident serious because the system had presented completely fabricated information as if it came from someone who had actually witnessed something.</p><p>And honestly, that’s the part I find more interesting than the murder story itself.</p><blockquote><strong>The Problem Isn’t That AI Made Something Up</strong></blockquote><p>AI making things up isn’t exactly breaking news.</p><p>We’ve all seen hallucinations.</p><p>Ask an AI for a Flutter solution and sometimes it will confidently give you a method that doesn’t exist, a package from 2019, and three lines of code that somehow look completely reasonable.</p><p>I have personally trusted those three lines. I have also personally regretted it.</p><p>But usually, the hallucination stays inside the chat.</p><p>You read it. You realize it’s wrong. You move on.</p><p>With an AI agent, that’s different. The agent doesn’t just generate an answer. It can <strong>take an action</strong>.</p><p>It can open a website, fill a form, click a button, send something, create something, or interact with an actual system.</p><p>And suddenly the distance between <strong>“the AI said something stupid”</strong> and <strong>“the AI did something stupid”</strong> becomes very small.</p><p>That’s the part that makes me slightly uncomfortable.</p><blockquote><strong>And Then There’s Another Problem</strong></blockquote><p>Anthropic discovered the incident on September 28 but notified Philadelphia police in early October.</p><p>The police department called the roughly two-month delay in detecting and reporting the incident unacceptable.</p><p>That raises another question.</p><p>When an AI agent does something unexpected in the real world, <strong>who is responsible for noticing?</strong></p><p>The AI obviously isn’t going to raise its hand and say:</p><p>“Hey guys, small issue. I may have just submitted fictional evidence to the police.”</p><p>So the systems around these agents need to be good enough to detect when something has gone outside the intended task.</p><p>Anthropic has since stopped some evaluations from accessing live websites and added additional safeguards around these kinds of interactions.</p><p>And honestly, that’s probably the right direction.</p><p>Because giving an AI agent access to the internet is one thing.</p><p>Giving it the ability to <strong>change things on the internet</strong> is a completely different level of trust.</p><blockquote><strong>This Feels Like a Pattern</strong></blockquote><p>What makes this story interesting to me is that it’s not really about one fake murder tip.</p><p>We’ve been seeing more examples of AI agents doing things their creators didn’t intend — from interacting with government websites to bypassing restrictions and performing actions they were never specifically asked to perform.</p><p>And it reminds me of the recent AI security incidents I wrote about before.</p><p>The common theme isn’t necessarily that the AI is “evil.”</p><p>It’s that we’re giving these systems more autonomy, more tools and more access to real-world systems.</p><p>And then we’re discovering what happens when the instructions aren’t quite as clear as we thought they were.</p><p>As a developer, that feels very familiar.</p><p>Because sometimes the bug isn’t in the thing you were trying to build.</p><p>It’s in the assumption you made about what the system would do.</p><p>Except this time, the system has access to the internet.</p><p>And apparently a police tip form.</p><p>I’m still trying to decide whether that’s impressive or terrifying.</p><p>Probably both.</p><p>— Shivani Bagal 🤍</p><p><em>“I would really prefer my AI assistant to fix my code rather than become a confidential informant. I’m already struggling with my own bugs. I don’t need the AI creating new ones.”</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4d566a0e7b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[So Apparently PHP Had a Bug Sitting There for Years. And Then AI Found It.]]></title>
            <link>https://medium.com/@shivanibagal88/so-apparently-php-had-a-bug-sitting-there-for-years-and-then-ai-found-it-c13b6770cd44?source=rss-3574cdf35e31------2</link>
            <guid isPermaLink="false">https://medium.com/p/c13b6770cd44</guid>
            <category><![CDATA[php2shell]]></category>
            <category><![CDATA[bugs]]></category>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[Shivani Bagal]]></dc:creator>
            <pubDate>Tue, 27 Oct 2026 04:06:28 GMT</pubDate>
            <atom:updated>2026-10-27T04:06:28.250Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dcXoELl_ydJyE_KSIcoyYQ.png" /></figure><p><strong>“Hmm. Sounds like a backend problem.”</strong></p><p>And then I quietly go back to my Flutter code.</p><p>Unfortunately, my company uses PHP.</p><p>So when I started seeing news about two critical vulnerabilities in PHP that were suddenly causing websites to go offline, my first reaction was not:</p><p><em>“Wow. This is an important cybersecurity event.”</em></p><p>It was more like:<em>“Oh.”</em></p><p><em>“This is actually our problem.”</em></p><p>So obviously, I started reading. And the more I read, the more ridiculous the whole thing became.</p><p>Two critical vulnerabilities. Remote code execution. Millions of websites potentially affected. Companies and governments taking services offline. AI helping researchers find and develop the exploit.</p><p>And the bugs?</p><p><strong>They had been sitting inside PHP for more than a decade.</strong></p><p>Apparently they were just waiting for their moment.</p><blockquote><strong>Okay. What Actually Happened?</strong></blockquote><p>On October 21, 2026, the PHP team released emergency security updates for two critical vulnerabilities:</p><ul><li><strong>CVE-2026–109618</strong></li><li><strong>CVE-2026–109619</strong></li></ul><p>They’ve since been referred to as <strong>PHP2Shell</strong>. Both vulnerabilities affect the PHP runtime itself and were rated <strong>9.2 on the CVSS scale</strong>. The scary part is that successful exploitation can allow an attacker to execute code remotely <strong>without authentication</strong> on vulnerable systems. <a href="https://www.wiz.io/blog/php2shell-php-rce?utm_source=chatgpt.com">wiz.io</a> And this isn’t a vulnerability hiding inside one obscure PHP package. It’s in PHP itself. That distinction matters.</p><p>You could have a perfectly secure application sitting on top of a vulnerable PHP runtime and still have a problem.</p><p>Which is a slightly uncomfortable thought. Especially if you’re someone who has spent three hours checking your application code only to discover the actual problem is somewhere underneath it.</p><blockquote><strong>The Bug Was Older Than Some of My Code</strong></blockquote><p>This is the part that got my attention.</p><p>The vulnerabilities affect PHP versions going back to <strong>PHP 5.4</strong>, meaning the underlying problematic code had been around for more than a decade. <a href="https://www.wiz.io/blog/php2shell-php-rce?utm_source=chatgpt.com">wiz.io</a></p><p>And before someone reads that and thinks:</p><blockquote><strong><em>“So there was an RCE sitting there for 10 years?”</em></strong></blockquote><p>Not exactly. Vulnerable conditions existed for years. But turning them into a reliable, remotely exploitable attack required chaining multiple memory-safety problems together and dealing with things like PHP’s memory layout, request handling and different application configurations.</p><p>In other words:</p><p><strong>The bug existed. The practical exploit was the hard part.</strong></p><p>And apparently that distinction became much less comforting in 2026.</p><blockquote>Why Was It So Difficult to Exploit?</blockquote><p>The vulnerabilities involve memory-safety issues in PHP’s core engine.</p><p>Very simplified version: PHP can hit certain fatal or out-of-memory conditions while processing a request. That can leave internal state in a bad condition. A later request or worker can potentially reuse that stale state. And from there, an attacker may be able to read or corrupt memory. Eventually, that can become remote code execution. <a href="https://www.wiz.io/blog/php2shell-php-rce?utm_source=chatgpt.com">wiz.io</a></p><p>I say <strong>“very simplified”</strong> because the actual technical details get deep very quickly. And I have a healthy respect for my own limitations. I am a Flutter developer. I am not going to read one memory-corruption research paper at 2 AM and suddenly become the final boss of exploit development.</p><p>Although, knowing me, I would probably try. Then spend the next three hours wondering why the exploit doesn’t compile.</p><blockquote><strong>And Then Websites Started Going Offline</strong></blockquote><p>This is where the story stopped being an interesting security article and became an actual internet problem.</p><p>Governments, companies and public institutions around the world temporarily took websites and services offline while they assessed and patched their systems.</p><p>Reuters reported outages across Europe, Asia and North America, including government portals and public services. Organizations in Germany, France, Belgium, the Netherlands, Finland and the Czech Republic took services offline, while other organizations including the Wikimedia Foundation and Internet Archive also temporarily restricted services.</p><p>And this wasn’t necessarily because all of those systems had already been hacked. A lot of the shutdowns were <strong>precautionary</strong>.</p><p>Basically:</p><p><em>“We don’t know whether we’re vulnerable enough yet, so let’s remove the thing from the internet while we figure it out.”</em></p><p>Which, honestly, is probably the least exciting but most responsible sentence in this entire story.</p><blockquote><strong>Final Thoughts</strong></blockquote><p>I’m still a Flutter developer.</p><p>I still have plenty of problems that can be solved by staring at an error message for 20 minutes and then changing one line of code.</p><p>But incidents like PHP2Shell are a good reminder that the applications we build don’t live in isolation.</p><p>“Apparently sometimes the backend problem becomes <strong>everyone’s problem</strong>.”</p><p>— <strong>Shivani Bagal 🤍</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c13b6770cd44" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chasing Dreams Or Living Life — Does It Have To Be One Or The Other?]]></title>
            <link>https://medium.com/@shivanibagal88/chasing-dreams-or-living-life-does-it-have-to-be-one-or-the-other-8119b1b41ec9?source=rss-3574cdf35e31------2</link>
            <guid isPermaLink="false">https://medium.com/p/8119b1b41ec9</guid>
            <category><![CDATA[dreams]]></category>
            <category><![CDATA[life]]></category>
            <dc:creator><![CDATA[Shivani Bagal]]></dc:creator>
            <pubDate>Tue, 08 Sep 2026 05:53:18 GMT</pubDate>
            <atom:updated>2026-09-08T05:53:18.963Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UpriSaM3_XJnW5jh85ta1g.jpeg" /></figure><p>I’ve been thinking about this for a while and I’m still not sure I have a clean answer. But I have thoughts. Strong ones. And this blog is where they’re going.</p><p>Here’s the question — when people say “chase your dream” and “give it everything you have” — what exactly are they asking you to give?</p><blockquote>The Dream Chaser Version</blockquote><p>You know this person. Maybe you are this person sometimes.</p><p>They have a goal. A business, a career milestone, a vision of something they want to build. And they’re going after it completely. Every hour goes into it. Every decision is filtered through “does this help me get there.” They’re strict with people around them because standards must be maintained. They’re unavailable because there’s always something that needs their attention. They’re building something. Sacrificing for it. Grinding for it.</p><p>And from the outside — this can look like admirable dedication. From the inside — sometimes it looks like dedication. And sometimes it looks like a person slowly pushing away everyone who matters to them in pursuit of something that was supposed to make their life better.</p><p>Here’s what I keep thinking about.</p><p>If your business succeeds — who are you celebrating with?</p><p>If the goal is achieved — who’s there when you get there?</p><p>If you spent ten years being unavailable, being strict, not giving your family the time they needed, not showing up for your friends — the business might be successful. But the life around it might be empty. And what’s the point of the success then?</p><blockquote>The Other Version</blockquote><p>Then there’s the other approach. The one I find myself leaning toward.</p><p>Make progress. But not at the cost of everything else.</p><p>Do good work. But also come home and be present. Meet your deadlines. But also show up for your family’s needs. Build something. But don’t build it on the ruins of your relationships.</p><p>There’s this idea that “balance” means you’re not serious enough. That if you’re going home at a reasonable time you’re not committed enough. That if you have time for your friends you’re not working hard enough.</p><p>I think that’s wrong. I think that’s a story people tell themselves to justify choices that are hurting the people around them.</p><p>Progress doesn’t have to be violent. It can be slow and it can be steady and it can happen while you’re also a good daughter, a good friend, a good colleague. The person who is making a little progress every day — without pressuring anyone, without ignoring their family, doing their chores and living their life alongside the work — that person is also building something. Just differently.</p><blockquote>The Thing Nobody Talks About</blockquote><p>Here’s the part that really gets me.</p><p>Even if the dream works out — even if the business succeeds, the goal is achieved, the vision becomes real — you still have to live your life after that. And the habits you built while chasing it, the relationships you neglected, the person you became in the process — those come with you.</p><p>The person who was strict and unavailable and all-consumed for ten years doesn’t suddenly become warm and present the moment they succeed. The people who were ignored and undervalued don’t suddenly feel valued the moment the business is profitable.</p><p>Success doesn’t undo the damage done on the way there.</p><blockquote>What I Actually Believe</blockquote><p>I believe you can want things and work toward them without destroying what you already have.</p><p>I believe slow progress is still progress. I believe showing up for your family is not weakness. I believe having time for your friends is not a sign that you’re not serious. I believe that being happy in what you have right now — while still moving toward something — is not settling. It’s actually really hard and really mature and most people can’t do it.</p><p>The dream that requires you to give up your humanity to achieve it — is it really worth achieving?</p><p>The success that nobody is around to celebrate — is it really success?</p><p>I’m not saying don’t have ambitions. I’m not saying don’t work hard. I’m saying — be careful about what you decide to sacrifice along the way. Because some things, once gone, don’t come back just because you became successful.</p><p>Build the dream. But don’t demolish your life to do it.</p><p>Make progress. But not at the price of the people who make the progress worth something.</p><p>Be happy in what you have today. Work toward what you want tomorrow. Those two things can coexist. They should coexist.</p><p>That’s what I actually believe.</p><p><em>— Shivani Bagal </em>🤍<em>,</em></p><p><em>who is making progress every day and also made time to write this blog and is very okay with that</em></p><p><em>“Where do you land on this — all-in or balanced? Drop it in the comments. This is one of those topics where I genuinely want to hear what other people think.”</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8119b1b41ec9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter 3.47 Is Here — And Material Is Finally Moving Out]]></title>
            <link>https://medium.com/@shivanibagal88/flutter-3-47-is-here-and-material-is-finally-moving-out-528600be41bf?source=rss-3574cdf35e31------2</link>
            <guid isPermaLink="false">https://medium.com/p/528600be41bf</guid>
            <category><![CDATA[news]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Shivani Bagal]]></dc:creator>
            <pubDate>Tue, 25 Aug 2026 04:26:02 GMT</pubDate>
            <atom:updated>2026-08-25T04:26:02.732Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3EIH_rBpnOtMIqtv2yPW7A.png" /></figure><p>Flutter 3.47 dropped on August 12, 2026. If you haven’t run flutter upgrade yet — do it now and then come back and read this so you know what actually changed.</p><p>I covered 3.41 through 3.44 in a previous post. This one picks up from there. Same format — what actually changed, what actually matters, and which ones you need to pay attention to right now.</p><p>Let’s go.</p><blockquote>The Headline — Material And Cupertino Are Now Standalone Packages</blockquote><p>This is the big one. The thing that’s been building since 3.41 is now actually here.</p><p>Flutter 3.47 ships the <strong>1.0 release of </strong><strong>material_ui and </strong><strong>cupertino_ui</strong> as standalone packages on pub.dev. This is the moment when Material and Cupertino officially start their life outside the core Flutter SDK.</p><p>What this means in practice — instead of:</p><pre>import &#39;package:flutter/material.dart&#39;;</pre><p>You’ll eventually be writing:</p><pre>import &#39;package:material_ui/material_ui.dart&#39;;</pre><p><strong>The key word is eventually.</strong> The original design libraries inside the core SDK are still there in 3.47. They’re scheduled for <strong>formal deprecation in the November Fall stable release</strong>. So you have time. But the clock is now officially ticking.</p><p>Flutter provides a migration tool to do the heavy lifting:</p><pre>dart fix --apply --code=migrate_design_widgets</pre><p>Run this on your project and it updates your imports automatically. If the tool has issues with your pubspec.yaml — there&#39;s a known early bug — you can fix it manually:</p><pre>flutter pub add material_ui<br>dart fix --apply</pre><p>If you’re a <strong>package author</strong> — this is urgent for you. The recommendation is to treat the move to standalone packages as a major release of your package. Migrate, bump your version, publish. Your users depend on you being ready before November.</p><p>If you’re building an <strong>app</strong> — you have until November before the deprecation hits. Start migrating now, not in October.</p><blockquote>Why This Actually Matters</blockquote><p>Moving Material and Cupertino out of the core SDK means design updates can ship independently — weekly instead of waiting for a full Flutter release cycle.</p><p>When Apple does something dramatic like a design overhaul, Flutter can react in days instead of months. When Material 3 gets a new component, it ships as a package update. No waiting for the next stable Flutter release. No forcing everyone to upgrade their entire SDK just to get a new widget.</p><p>The decoupling is good for the ecosystem. The migration is a bit of work. Worth it.</p><blockquote>Impeller Comes To Desktop — All Platforms Now</blockquote><p>Impeller — Flutter’s custom rendering engine that replaced Skia — is now the <strong>default renderer on macOS, Windows, and Linux</strong> in Flutter 3.47.</p><p>It was already stable on iOS and Android from 3.44. Desktop is now complete.</p><p>What this means: smoother animations, no shader compilation jank, consistent performance across the first frame and every frame after. The rendering difference is real especially on macOS where Skia had always been a bit rough around the edges.</p><p>If you’re building desktop Flutter apps — this is a genuine quality of life improvement that your users will feel even if they can’t articulate why.</p><blockquote>Widget Previews Graduate To Stable</blockquote><p>Widget Previews — the ability to preview individual widgets without running the full app — are now <strong>stable</strong> in Flutter 3.47.</p><p>The 3.47 version specifically brings:</p><ul><li><strong>Local build caching</strong> — faster startup times for previews</li><li><strong>Real-time preview search and filtering</strong> — find the widget you want to preview quickly</li></ul><p>This is the feature that changes how you build UI. Instead of hot reload → scroll to the right screen → check the widget → change something → repeat — you open the preview directly, see the widget in isolation, iterate faster.</p><p>If you haven’t tried Widget Previews yet — now that they’re stable, it’s worth integrating into your workflow.</p><blockquote>iOS And macOS Minimum Versions Just Jumped</blockquote><p>This one needs your attention before you do anything else.</p><p>Flutter 3.47 raises the minimum supported versions:</p><ul><li><strong>iOS: 13 → 15</strong> (dropped iOS 13 and 14 support)</li><li><strong>macOS: 10.15 → 12</strong> (dropped older macOS versions)</li></ul><p>This is happening to support Xcode 27, iOS 27, and macOS 27 which are all coming later this year.</p><p>Before upgrading to 3.47 — check what iOS versions your users are actually on. If you have a significant portion on iOS 13 or 14 — they will no longer be able to use your app after you build with 3.47. That’s a real user impact decision, not just a technical one.</p><p>For most apps built in 2025 and 2026 — the vast majority of users are already on iOS 15+. But check your analytics before assuming.</p><blockquote>UIScene Lifecycle — Now Mandatory For Xcode 27</blockquote><p>If you build with Xcode 27 — the UIScene lifecycle is now <strong>mandatory</strong> for iOS apps. Apps without it will fail to launch on iOS 27.</p><p>Flutter CLI handles most of the migration automatically. But if you have a custom AppDelegate or SceneDelegate — check carefully. This is the kind of thing that works fine until it doesn&#39;t and then it&#39;s an urgent production issue.</p><p>The automatic migration covers standard Flutter setups. Custom native code means manual verification.</p><blockquote>Intel Mac Support Being Phased Out</blockquote><p>Flutter 3.47 begins phasing out Intel Mac support. If you’re still building on an Intel Mac — start planning your transition to Apple Silicon.</p><p>This isn’t sudden removal. It’s the beginning of the deprecation path. But it’s coming.</p><blockquote>Dart 3.13 — What’s New In The Language</blockquote><p>Flutter 3.47 ships with <strong>Dart 3.13</strong>. A few things worth knowing:</p><blockquote>Primary Constructors — Expanded Documentation</blockquote><p>Primary constructors — the new Dart feature that lets you declare constructor parameters directly in the class signature — now has expanded documentation including coverage of enums and constant constructors.</p><pre>// Old way<br>class User {<br>  final String name;<br>  final int age;<br><br>User({required this.name, required this.age});<br>}<br>// With primary constructors<br>class User(String name, int age);</pre><p>Cleaner, less boilerplate. Still experimental in some scenarios — check the Dart docs for the current status on what’s supported.</p><blockquote>Private Named Parameters</blockquote><p>Private named parameters — documented in Dart 3.12, now with more coverage in 3.13 — let you have named parameters that are only accessible within the library. Useful for internal APIs that need named parameters without exposing them publicly.</p><blockquote>Dot Shorthands Migration Complete</blockquote><p>The dot shorthands feature — which lets you write .value instead of ClassName.value when the type is inferred — has completed its migration across Flutter&#39;s own APIs and examples. Cleaner code, less repetition.</p><blockquote>Things To Do After Upgrading To 3.47</blockquote><p><strong>Immediately:</strong></p><ul><li>Run flutter upgrade</li><li>Check your minimum iOS version setting — make sure you’re aware of the 13→15 change</li><li>Verify your app still builds and runs correctly</li></ul><p><strong>Soon:</strong></p><ul><li>Run dart fix --apply --code=migrate_design_widgets to start Material/Cupertino migration</li><li>Test Widget Previews if you haven’t already</li></ul><p><strong>Before November:</strong></p><ul><li>Complete the Material/Cupertino migration before the deprecation lands in the Fall stable release</li><li>If you’re a package author — migrate and publish now</li></ul><p><strong>If you build with Xcode 27:</strong></p><ul><li>Verify UIScene lifecycle migration is complete</li><li>Test on iOS 27 simulator</li></ul><blockquote>The Quick Summary</blockquote><p>Feature Status material_ui + cupertino_ui 1.0 ✅ Available — migrate before November Impeller on desktop ✅ Default — all platforms now Widget Previews ✅ Stable — use them iOS minimum. 13 → 15 — check your users macOS minimum. 0.15 → 12 — check your users Intel Mac support Being phased out UIScene lifecycle (Xcode 27) . Now mandatory Dart 3.13 ✅ Primary constructors expanded, dot shorthands complete</p><p>Flutter 3.47 is a housekeeping release as much as a features release. The big features were in 3.44. The big migrations are what 3.47 is pushing you toward. The November deprecation of the core design libraries is the deadline that makes this release more urgent than it might initially appear.</p><p>Run the upgrade. Start the migration. Don’t wait for October.</p><p><em>— Shivani Bagal </em>🤍<em>,</em></p><p><em>who has already run flutter upgrade and is now looking at the migration tool output with interest</em></p><p><em>“Missed the previous Flutter release roundup? I covered Flutter 3.41 through 3.44 — check that post for the full picture of what changed in the first half of 2026.”</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=528600be41bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Mocktail Obsession — Recipes, Boba, Glitter Bombs, And The App I Built For This]]></title>
            <link>https://medium.com/@shivanibagal88/my-mocktail-obsession-recipes-boba-glitter-bombs-and-the-app-i-built-for-this-258e2b206aae?source=rss-3574cdf35e31------2</link>
            <guid isPermaLink="false">https://medium.com/p/258e2b206aae</guid>
            <category><![CDATA[boba]]></category>
            <category><![CDATA[best-mocktails]]></category>
            <category><![CDATA[drinks]]></category>
            <dc:creator><![CDATA[Shivani Bagal]]></dc:creator>
            <pubDate>Thu, 20 Aug 2026 09:24:30 GMT</pubDate>
            <atom:updated>2026-08-20T09:24:30.456Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*w7OkV1Ng1Fn9G1rGtDscvA.png" /></figure><p>I make drinks. Not professionally. Just as a hobby that has slowly taken over a significant portion of my kitchen counter and my weekend plans.</p><p>It started with trying mocktails at cafes and thinking — I can make this at home. Spoiler: sometimes you can and sometimes you discover that what the cafe does involves equipment you do not own. But most of the time, with the right ingredients and a little experimentation, you can make something genuinely good.</p><p>This is my current drink obsession list — the flavors I keep coming back to, the things I’ve tried, and a few recipes that actually work. And at the end — the app I built because my drink experimentation needed a smarter way to figure out what to make with what I have.</p><blockquote>The Flavors I Keep Coming Back To</blockquote><p>Before recipes — my flavour philosophy.</p><p><strong>Peach and Apricot</strong> — warm, sweet, slightly floral. They both have this soft stone fruit quality that makes drinks feel luxurious without being heavy. Peach syrup, apricot nectar, fresh peach if you can get it — these are in my fridge more often than not.</p><p><strong>Passionfruit</strong> — tart, tropical, slightly exotic. Passionfruit has this quality where it makes everything taste more interesting. A basic lemonade becomes something special with passionfruit. A plain soda becomes something you’d pay ₹300 for at a cafe. It’s that ingredient.</p><p>These three are my comfort zone. Everything else I’m actively trying for the first time.</p><blockquote>The Boba Obsession — Currently At Peak Level</blockquote><p>Okay so boba. Bubble tea. Whatever you call it — I am currently obsessed and I am not hiding it.</p><p>If you haven’t tried <strong>popping boba</strong> yet — please stop reading this right now and go find some. Popping boba is the version where the pearls burst in your mouth with actual fruit juice inside. It is absolutely unhinged in the best possible way. Every sip is a small surprise. I have tried multiple flavors and I have no plans to stop.</p><p>My current boba rotation:</p><p><strong>Classic milk tea with tapioca pearls</strong> — the original, still undefeated. Sweet, creamy, chewy. There’s a reason this started a whole global trend.</p><p><strong>Green apple boba</strong> — tart and refreshing in a way that cuts through the sweetness. The green apple flavor is very specific and very satisfying. Not for everyone. Very much for me.</p><p><strong>Passionfruit boba</strong> — my two obsessions combined. Tart, tropical, bright yellow, popping boba if possible. This is the one I make at home the most.</p><p><strong>Blue Lagoon</strong> — visually stunning, tastes like summer. Blue curacao syrup (non-alcoholic version), lemonade, soda, ice. The color alone makes you feel like you’re somewhere with a view.</p><blockquote>Making Boba At Home — It’s Actually Not That Hard</blockquote><p>The part people think is complicated is the tapioca pearls. It’s not complicated, it just requires attention.</p><p><strong>Basic Boba Recipe:</strong></p><p>For the pearls:</p><ul><li>1 cup dried tapioca pearls</li><li>4 cups water</li><li>Brown sugar or honey to sweeten</li></ul><p>Boil water. Add pearls. Cook on medium heat, stirring occasionally, until they float and are tender all the way through — usually 15–20 minutes. Drain, rinse with cold water, toss immediately with a little brown sugar or honey so they don’t stick together.</p><p>Use them within a few hours. Tapioca pearls get hard if they sit too long. Make them fresh each time.</p><p><strong>Passionfruit Boba Mocktail:</strong></p><ul><li>2 tbsp cooked tapioca pearls (or popping boba)</li><li>3 tbsp passionfruit syrup or pulp</li><li>1 cup milk (dairy or plant-based)</li><li>½ cup ice</li><li>Splash of soda for fizz (optional)</li></ul><p>Blend the passionfruit and milk with ice. Pour over the pearls. Add soda if you want it bubbly. Drink immediately through a wide straw so you get the pearls with every sip.</p><blockquote>The Blue Lagoon — Easy, Beautiful, Always Impressive</blockquote><p>This one looks like it took effort. It did not.</p><p><strong>Ingredients:</strong></p><ul><li>Blue curacao syrup (non-alcoholic) — 2 tbsp</li><li>Fresh lemon juice — 3 tbsp</li><li>Simple syrup — 1 tbsp (sugar dissolved in equal parts water)</li><li>Soda water — 1 cup</li><li>Ice</li><li>Slice of lemon for garnish</li></ul><p><strong>Method:</strong> Mix the blue curacao syrup with lemon juice and simple syrup in a glass. Add ice. Pour soda water slowly down the side of the glass so it doesn’t lose its fizz. Stir gently. Add the lemon slice. Done.</p><p>The blue color comes from the curacao syrup. It’s dramatic and pretty and requires approximately five minutes to make. Great for when you have guests and want something that looks like you tried harder than you did.</p><blockquote>Virgin Piña Colada — The Classic That Never Gets Old</blockquote><p><strong>Ingredients:</strong></p><ul><li>1 cup fresh pineapple chunks (or canned pineapple in juice)</li><li>½ cup coconut cream</li><li>½ cup ice</li><li>Pineapple slice and cherry to garnish</li></ul><p><strong>Method:</strong> Blend everything until smooth and creamy. Pour into a glass. Garnish. Drink.</p><p>That’s it. That’s the whole recipe. The only way to mess this up is to use coconut milk instead of coconut cream — the cream is what makes it rich and thick. Use the cream.</p><p>If you want it slightly lighter — use half coconut cream and half coconut water. Different texture, still delicious.</p><blockquote>The Cotton Candy Glitter Bomb — The Viral One</blockquote><p>Okay yes I tried this. And yes it is as extra as it sounds and yes it is absolutely worth it.</p><p><strong>What it is:</strong> You put cotton candy in the glass first. You pour your drink over it slowly. The cotton candy dissolves dramatically into the drink, releasing color and flavor. If you add edible glitter — it swirls through the drink as the cotton candy melts.</p><p><strong>How to make it:</strong></p><ul><li>Make any flavored mocktail base — lemonade, soda, fruit juice, whatever flavor you want</li><li>Add a small amount of edible glitter to the drink base (optional but dramatic)</li><li>Put a cloud of cotton candy in your glass</li><li>Pour the drink slowly over the cotton candy</li><li>Watch it dissolve and swirl</li><li>Drink immediately before the drama settles</li></ul><p>The flavor from the cotton candy adds mostly sweetness — it’s about the visual experience as much as the taste. Blue cotton candy into lemonade looks incredible. Pink cotton candy into anything looks like a cloud dissolving. Green apple soda with green cotton candy and gold glitter looks unhinged and I mean that as a compliment.</p><p>I’ve made this in multiple flavors. Every time someone sees it happen they say “wait what” and want to try it immediately.</p><blockquote>Peach Apricot Fizz — My Personal Favourite</blockquote><p>This is the one I make most often and the one that feels most like mine.</p><p><strong>Ingredients:</strong></p><ul><li>3 tbsp peach syrup or fresh peach puree</li><li>2 tbsp apricot nectar</li><li>Juice of half a lemon</li><li>½ tsp honey (optional — if you want more sweetness)</li><li>Soda water — 1 cup</li><li>Ice</li><li>Fresh mint and peach slice to garnish</li></ul><p><strong>Method:</strong> Mix peach syrup, apricot nectar, lemon juice, and honey in a glass. Add ice. Pour soda water slowly. Stir once gently. Garnish with mint and a peach slice if you have one.</p><p>The lemon cuts through the sweetness and makes the peach and apricot flavors brighter. The soda adds the fizz that makes it feel like a proper drink. The mint is mostly aesthetic but it does add something.</p><p>This is my go-to for when I want something that tastes genuinely good and not like I’m trying too hard.</p><blockquote>The App I Built For This — BarBrain</blockquote><p>Here’s where this gets meta.</p><p>My drink experimentation got to a point where I’d look at what I had in the kitchen and not know what to make with it. Peach syrup, some coconut cream, soda, lemon — what can I actually make with this combination?</p><p>So I built an app. <strong>BarBrain</strong> — a Gemini AI powered drink suggester. You tell it what ingredients you have and what kind of drink you’re in the mood for, and it suggests what you can make. Cocktails, mocktails, whatever direction you want to go.</p><p>It was my first project integrating Google’s Gemini AI and building it taught me a lot about how to structure prompts properly to get specific, useful suggestions instead of vague generic ones. The difference between asking an AI “what can I make” and telling it exactly what you have and what mood you’re in is dramatic.</p><p>BarBrain isn’t published anywhere yet — it was a portfolio project and a personal tool. But it’s the most used app I’ve ever built for myself, which is probably the best review any app can get.</p><blockquote>The Honest Mocktail Tip Nobody Mentions</blockquote><p>Fresh citrus makes everything better. Every single recipe above is improved by fresh lemon or lime juice compared to bottled.</p><p>Bottled lemon juice tastes flat. Fresh lemon juice tastes bright. The difference is noticeable and it costs almost nothing. Keep lemons and limes in your kitchen. Use them in everything.</p><p>That’s it. That’s the tip. It’s boring and it’s true and it will improve every drink you make immediately.</p><p><em>— Shivani Bagal </em>🤍<em>,</em></p><p><em>currently deciding which boba flavor to try next and taking this very seriously</em></p><p><em>“Made one of these? Or have a mocktail recipe that deserves to be on this list? Drop it in the comments — always looking for the next thing to try.”</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=258e2b206aae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter App Size Optimization — Why Your APK Is 300MB And How To Fix It]]></title>
            <link>https://medium.com/@shivanibagal88/flutter-app-size-optimization-why-your-apk-is-300mb-and-how-to-fix-it-3c15d6faf43c?source=rss-3574cdf35e31------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c15d6faf43c</guid>
            <category><![CDATA[mobile-app-optimization]]></category>
            <dc:creator><![CDATA[Shivani Bagal]]></dc:creator>
            <pubDate>Thu, 20 Aug 2026 04:15:09 GMT</pubDate>
            <atom:updated>2026-08-20T04:15:09.307Z</atom:updated>
            <content:encoded><![CDATA[<p>You build your Flutter app. You run flutter build apk. You look at the file size — 300MB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*Pl8walsuoFZtzzYgRfrq_g.png" /></figure><p>Three hundred megabytes. For an app that does things most websites handle in a few hundred kilobytes. You stare at this number. You wonder what went wrong. You wonder if this is normal. You wonder if maybe you should have become a chef instead.</p><p>It’s not normal. And it’s fixable. Let me show you how.</p><blockquote>Why Flutter APKs Are Large By Default</blockquote><p>Before fixing the problem, let’s understand why it exists.</p><p>Flutter compiles your Dart code to native ARM code. It also bundles the Flutter engine — the rendering engine, the Dart runtime, all the graphics code. And it bundles for multiple CPU architectures by default — armeabi-v7a (32-bit ARM), arm64-v8a (64-bit ARM), and x86_64 (emulators).</p><p>When you run flutter build apk — you get one fat APK that contains native libraries for ALL architectures. A user with a 64-bit phone downloads everything including the 32-bit libraries they&#39;ll never use. That&#39;s the first big reason your APK is large.</p><p>Add to that — every package you’ve added has its own native code, every asset you’ve included is bundled, and ProGuard probably isn’t optimizing your code. It all adds up fast.</p><p>The good news — most of this is fixable with the right build configuration.</p><blockquote>Fix 1 — Use App Bundle Instead Of APK</blockquote><p>This is the biggest single improvement you can make and it requires zero code changes.</p><pre># Don&#39;t do this for Play Store releases<br>flutter build apk<br><br># Do this instead<br>flutter build appbundle</pre><p>An App Bundle (.aab) lets the Play Store deliver only what each specific device needs. A user with a 64-bit ARM phone gets only the arm64-v8a libraries. A user with a 32-bit phone gets only armeabi-v7a. Nobody gets everything.</p><p>The difference in what users actually download can be 50–60% smaller than a universal APK.</p><p>You should already be using AAB for Play Store releases. If you’re not — switch immediately. This alone can take your 300MB install down significantly.</p><p><strong>For testing on a device directly</strong> — AAB doesn’t install directly on a device, only APK does. That’s fine. Use APK for local testing, AAB for Play Store.</p><blockquote>Fix 2 — Split APKs By ABI</blockquote><p>If you still need APKs (for direct distribution, not Play Store) — build separate APKs per architecture instead of one fat APK:</p><pre>flutter build apk --split-per-abi</pre><p>This generates three separate APKs:</p><ul><li>app-armeabi-v7a-release.apk — for 32-bit devices</li><li>app-arm64-v8a-release.apk — for 64-bit devices</li><li>app-x86_64-release.apk — for emulators</li></ul><p>Each one is significantly smaller than the universal APK. Distribute the right one to the right device.</p><blockquote>Fix 3 — Enable ProGuard And R8 — The build.gradle Changes</blockquote><p>This is what you were thinking of in build.gradle. In android/app/build.gradle:</p><pre>android {<br>    buildTypes {<br>        release {<br>            // Enable minification and obfuscation<br>            minifyEnabled true<br>            shrinkResources true<br>            proguardFiles getDefaultProguardFile(&#39;proguard-android-optimize.txt&#39;), &#39;proguard-rules.pro&#39;<br><br>// Sign with your release key<br>            signingConfig signingConfigs.release<br>        }<br>    }<br>}</pre><p>minifyEnabled true — enables R8 (Android&#39;s code shrinker). It removes unused code from your app and all your dependencies. Dead code that was sitting in packages you imported but never fully used — gone.</p><p>shrinkResources true — removes unused resources. Images, layouts, strings that are in your dependencies but never actually used by your app — removed.</p><p>These two together can significantly reduce your final APK/AAB size. They’re disabled by default because they require proper ProGuard rules and they can break things if rules are missing. Hence the third line:</p><p>proguardFiles — your ProGuard rules file. This is where you add the keep rules for packages that would otherwise get broken by minification. Every package blog I&#39;ve written — Razorpay, Cashfree, Stripe, FlutterCallKit — all had ProGuard rules to add. This is why.</p><blockquote>Fix 4 — ABI Filters In build.gradle</blockquote><p>If you’re building for modern Android devices and don’t need 32-bit support, you can restrict which architectures are built:</p><pre>android {<br>    defaultConfig {<br>        ndk {<br>            abiFilters += listOf(&quot;arm64-v8a&quot;, &quot;armeabi-v7a&quot;)<br>            // Remove x86_64 if you don&#39;t need emulator support in release<br>        }<br>    }<br>}</pre><p>You’ve actually already done this — this was part of the 16KB page size changes. The abiFilters setting is doing double duty here — it both ensures 16KB compliance AND controls which architectures are included in your build.</p><blockquote>Fix 5 — Optimize Your Assets</blockquote><p>Assets are often a bigger contributor to app size than developers realize.</p><p><strong>Images — use the right format:</strong></p><pre># In pubspec.yaml<br>flutter:<br>  assets:<br>    - assets/images/</pre><p>PNG for images with transparency. JPEG for photos. WebP for everything else where possible — WebP typically gives 25–35% smaller files than PNG or JPEG at the same quality.</p><p><strong>SVGs instead of multiple resolution PNGs:</strong></p><p>If you’re using flutter_svg — great. SVGs are tiny. One SVG file instead of @1x, @2x, @3x PNG variants.</p><p><strong>Remove assets you don’t use.</strong> Sounds obvious. Check your assets folder — there are probably images in there from features that got removed or redesigned six months ago. They’re still bundled. Delete them.</p><p><strong>Compress your images.</strong> Run your PNG assets through a compressor like TinyPNG or ImageOptim before adding them to the project. A 2MB PNG can often become a 400KB PNG with no visible quality difference.</p><blockquote>Fix 6 — Deferred Components (Advanced)</blockquote><p>For large apps — Flutter supports deferred loading. You can split your app into components that are downloaded on demand rather than bundled upfront.</p><pre>import &#39;package:flutter/foundation.dart&#39;;<br><br>// Declare a deferred import<br>import &#39;feature/heavy_feature.dart&#39; deferred as heavyFeature;<br>// Load it when needed<br>Future&lt;void&gt; loadHeavyFeature() async {<br>  await heavyFeature.loadLibrary();<br>  heavyFeature.HeavyFeatureScreen();<br>}</pre><p>This is more complex to set up and requires Play Store’s dynamic delivery. But for apps with large features that most users rarely use — it can dramatically reduce initial download size.</p><blockquote>Fix 7 — Analyze What’s Actually Taking Space</blockquote><p>Before optimizing blindly — know what’s actually large.</p><p><strong>Flutter’s built-in size analysis:</strong></p><pre>flutter build apk --analyze-size</pre><p>This generates a size analysis report showing you exactly what’s contributing to your APK size. You’ll see Flutter engine, your Dart code, each package’s native libraries, and your assets — all broken down.</p><p>Run this before optimizing. You might discover it’s one specific package’s native library taking 50MB, not your assets at all. Fix the actual problem, not what you assumed was the problem.</p><blockquote>The build.gradle Summary — What It Should Look Like</blockquote><p>Here’s a clean release build configuration combining everything:</p><pre>android {<br>    defaultConfig {<br>        minSdkVersion 21<br>        targetSdkVersion 34<br><br>ndk {<br>            abiFilters += listOf(&quot;arm64-v8a&quot;, &quot;armeabi-v7a&quot;)<br>        }<br>    }<br>    buildTypes {<br>        release {<br>            minifyEnabled true<br>            shrinkResources true<br>            proguardFiles getDefaultProguardFile(&#39;proguard-android-optimize.txt&#39;),<br>                         &#39;proguard-rules.pro&#39;<br>            signingConfig signingConfigs.release<br>        }<br>    }<br>}</pre><blockquote>iOS App Size</blockquote><p>iOS apps are distributed through App Store Connect which handles thinning automatically — similar to Android App Bundle. Users download only what their device needs.</p><p>For iOS specifically:</p><p><strong>Bitcode</strong> — was deprecated by Apple in Xcode 14. Don’t enable it.</p><p><strong>Asset catalogs</strong> — use Xcode’s Asset Catalog for images. It handles device-specific variants and App Thinning automatically.</p><p><strong>On-demand resources</strong> — iOS equivalent of Android’s deferred components. Large assets can be downloaded when needed.</p><p><strong>Strip debug symbols in release builds</strong> — in Xcode Build Settings, ensure Strip Debug Symbols During Copy is enabled for release.</p><blockquote>What Actually Makes The Biggest Difference</blockquote><p>In order of impact for most Flutter apps:</p><ol><li><strong>AAB instead of APK</strong> — biggest impact, zero effort</li><li><strong>minifyEnabled + shrinkResources</strong> — significant impact, requires ProGuard rules</li><li><strong>Image optimization</strong> — often bigger than you expect</li><li><strong>ABI filters</strong> — meaningful impact on direct APK distribution</li><li><strong>Analyze before optimizing</strong> — know where your size actually comes from</li></ol><p>If your app is 300MB as a universal APK — using AAB and enabling minification alone will likely get you to under 100MB for most users. Sometimes significantly under.</p><blockquote>The Checklist</blockquote><ul><li>✅ Using AAB for Play Store releases, not APK</li><li>✅ minifyEnabled true in release build type</li><li>✅ shrinkResources true in release build type</li><li>✅ ProGuard rules for all native packages</li><li>✅ ABI filters set in build.gradle</li><li>✅ Images compressed and in right format</li><li>✅ No unused assets in the assets folder</li><li>✅ flutter build apk --analyze-size run to identify biggest contributors</li><li>✅ Tested release build after optimizations</li></ul><p>300MB APK going to 80MB user download is not magic. It’s just using the tools that are already there and that nobody tells you about when you’re starting out.</p><p>Your app is not too big. It’s just not optimized yet.</p><p><em>— Shivani Bagal</em>🤍<em>,</em></p><p><em>who has stared at a 300MB APK and lived to tell the tale</em></p><p><em>“What’s your APK size before and after optimization? Drop it in the comments — curious how much difference these changes make across different types of Flutter apps.”</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c15d6faf43c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Code Generation In Flutter — Stop Writing Boilerplate, Let The Machine Do It]]></title>
            <link>https://medium.com/@shivanibagal88/code-generation-in-flutter-stop-writing-boilerplate-let-the-machine-do-it-e7d2e2e78dce?source=rss-3574cdf35e31------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7d2e2e78dce</guid>
            <category><![CDATA[code-generation]]></category>
            <dc:creator><![CDATA[Shivani Bagal]]></dc:creator>
            <pubDate>Fri, 14 Aug 2026 07:15:54 GMT</pubDate>
            <atom:updated>2026-08-14T07:15:54.399Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*k1KIkQuFLOTVoywZvI7AhA.png" /></figure><p>Every Flutter developer has been there. You get an API response. It’s JSON. You need a Dart model. So you start writing fromJson and toJson by hand. Field by field. Line by line. And somewhere around the fifteenth field you start questioning your life choices.</p><p>There is a better way. It’s called code generation. And once you start using it, manually writing JSON parsing code feels like going back to writing assembly.</p><p>This post covers the two code generation tools I use in real production apps — json_serializable for your models and retrofit for your API clients. Both use build_runner to generate the code. Both will make your life significantly better.</p><blockquote>What Is Code Generation And Why Should You Care</blockquote><p>Code generation means you write a class with some annotations, run a command, and a tool generates the implementation for you automatically.</p><p>Instead of writing this by hand:</p><pre>class UserResponse {<br>  final String id;<br>  final String name;<br>  final String email;<br>  final String? avatar;<br>  final int age;<br><br>UserResponse({<br>    required this.id,<br>    required this.name,<br>    required this.email,<br>    this.avatar,<br>    required this.age,<br>  });<br>  factory UserResponse.fromJson(Map&lt;String, dynamic&gt; json) =&gt; UserResponse(<br>    id: json[&#39;id&#39;] as String,<br>    name: json[&#39;name&#39;] as String,<br>    email: json[&#39;email&#39;] as String,<br>    avatar: json[&#39;avatar&#39;] as String?,<br>    age: json[&#39;age&#39;] as int,<br>  );<br>  Map&lt;String, dynamic&gt; toJson() =&gt; {<br>    &#39;id&#39;: id,<br>    &#39;name&#39;: name,<br>    &#39;email&#39;: email,<br>    &#39;avatar&#39;: avatar,<br>    &#39;age&#39;: age,<br>  };<br>}</pre><p>You write this:</p><pre>@JsonSerializable()<br>class UserResponse {<br>  final String id;<br>  final String name;<br>  final String email;<br>  final String? avatar;<br>  final int age;<br><br>UserResponse({<br>    required this.id,<br>    required this.name,<br>    required this.email,<br>    this.avatar,<br>    required this.age,<br>  });<br>  factory UserResponse.fromJson(Map&lt;String, dynamic&gt; json) =&gt;<br>      _$UserResponseFromJson(json);<br>  Map&lt;String, dynamic&gt; toJson() =&gt; _$UserResponseToJson(this);<br>}</pre><p>And the generator writes the fromJson and toJson implementation for you in a .g.dart file.</p><p>Same result. Half the code. No manual mistakes. And when the API adds a new field — you add one line to your class and run the generator. Done.</p><h3>The Packages</h3><pre>dependencies:<br>  json_annotation: ^4.8.1<br>  retrofit: ^4.1.0<br><br>dev_dependencies:<br>  json_serializable: ^6.7.1<br>  build_runner: ^2.4.8<br>  retrofit_generator: ^8.1.0</pre><p>json_annotation — contains the annotations (@JsonSerializable, @JsonKey) that you put in your code. Goes in dependencies because your production code uses it.</p><p>json_serializable — the actual code generator. Goes in dev_dependencies because it only runs during development, not in your shipped app.</p><p>build_runner — the tool that runs all the generators. Also dev_dependencies.</p><p>retrofit — type-safe HTTP client generator. Goes in dependencies.</p><p>retrofit_generator — generates the Retrofit implementation. dev_dependencies.</p><blockquote>Part 1 — json_serializable</blockquote><h3>Basic Model</h3><pre>import &#39;package:json_annotation/json_annotation.dart&#39;;<br><br>// This tells Dart where the generated file will be<br>part &#39;user_response.g.dart&#39;;<br>@JsonSerializable()<br>class UserResponse {<br>  final String id;<br>  final String name;<br>  final String email;<br>  final String? avatar;<br>  const UserResponse({<br>    required this.id,<br>    required this.name,<br>    required this.email,<br>    this.avatar,<br>  });<br>  factory UserResponse.fromJson(Map&lt;String, dynamic&gt; json) =&gt;<br>      _$UserResponseFromJson(json);<br>  Map&lt;String, dynamic&gt; toJson() =&gt; _$UserResponseToJson(this);<br>}</pre><p>part &#39;user_response.g.dart&#39; — this tells Dart that the generated file is part of this file. The .g.dart file is what build_runner creates. Never edit these files. They get regenerated every time you run the generator.</p><p>@JsonSerializable() — marks this class for code generation.</p><p>_$UserResponseFromJson and _$UserResponseToJson — generated functions. They don&#39;t exist yet. They&#39;ll appear in the .g.dart file after you run the generator.</p><blockquote>Handling Different JSON Key Names</blockquote><p>Sometimes the API returns user_name but you want userName in your Dart model:</p><pre>@JsonSerializable()<br>class UserResponse {<br>  final String id;<br><br>@JsonKey(name: &#39;user_name&#39;)<br>  final String userName;<br>  @JsonKey(name: &#39;profile_image_url&#39;)<br>  final String? profileImageUrl;<br>  // ...<br>}</pre><p>@JsonKey(name: &#39;user_name&#39;) — tells the generator to map the JSON key user_name to this Dart field userName. API naming conventions don&#39;t have to match your Dart naming conventions.</p><blockquote>Nested Objects</blockquote><pre>part &#39;project_response.g.dart&#39;;<br><br>@JsonSerializable()<br>class ProjectResponse {<br>  final String id;<br>  final String name;<br>  final UserResponse? assignee; // Nested object<br>  const ProjectResponse({<br>    required this.id,<br>    required this.name,<br>    this.assignee,<br>  });<br>  factory ProjectResponse.fromJson(Map&lt;String, dynamic&gt; json) =&gt;<br>      _$ProjectResponseFromJson(json);<br>  Map&lt;String, dynamic&gt; toJson() =&gt; _$ProjectResponseToJson(this);<br>}</pre><p>For nested objects to work — the nested class (UserResponse) also needs @JsonSerializable() and its own fromJson. The generator handles the nesting automatically.</p><blockquote>Lists Of Objects</blockquote><pre>@JsonSerializable()<br>class ProjectListResponse {<br>  final int total;<br>  final List&lt;ProjectResponse&gt; projects; // List of objects<br><br>// ...<br>}</pre><p>Lists work automatically too. No special annotation needed for List&lt;ProjectResponse&gt; — json_serializable handles it.</p><blockquote>Custom Field Handling</blockquote><pre>@JsonSerializable()<br>class PaymentResponse {<br>  final String id;<br><br>---<br><br>  // Field exists in JSON but you want to ignore it in toJson<br>  @JsonKey(includeToJson: false)<br>  final String? internalNote;<br>  // Field with default value if JSON key is missing<br>  @JsonKey(defaultValue: false)<br>  final bool isVerified;<br>  // Custom converter for complex types<br>  @JsonKey(fromJson: _dateFromJson, toJson: _dateToJson)<br>  final DateTime createdAt;<br>  // ...<br>}<br>DateTime _dateFromJson(String date) =&gt; DateTime.parse(date);<br>String _dateToJson(DateTime date) =&gt; date.toIso8601String();</pre><blockquote>Part 2 — Retrofit</blockquote><p>Retrofit generates type-safe API clients from abstract classes. Instead of manually building Dio requests with URLs, headers, and body parsing — you define an interface and retrofit generates the implementation.</p><blockquote>Without Retrofit (The Manual Way)</blockquote><pre>// Every API call looks like this:<br>Future&lt;UserResponse&gt; getUser(String userId) async {<br>  final response = await dio.get(<br>    &#39;/users/$userId&#39;,<br>    options: Options(headers: {&#39;Authorization&#39;: &#39;Bearer $token&#39;}),<br>  );<br>  return UserResponse.fromJson(response.data);<br>}</pre><p>Works fine. Gets repetitive fast. Every endpoint needs the same setup code.</p><blockquote>With Retrofit (The Generated Way)</blockquote><pre>import &#39;package:retrofit/retrofit.dart&#39;;<br>import &#39;package:dio/dio.dart&#39;;<br>import &#39;package:json_annotation/json_annotation.dart&#39;;<br><br>part &#39;user_api.g.dart&#39;;<br>@RestApi(baseUrl: &#39;https://api.example.com&#39;)<br>abstract class UserApi {<br>  factory UserApi(Dio dio, {String baseUrl}) = _UserApi;<br>  @GET(&#39;/users/{id}&#39;)<br>  Future&lt;UserResponse&gt; getUser(@Path(&#39;id&#39;) String userId);<br>  @GET(&#39;/users&#39;)<br>  Future&lt;List&lt;UserResponse&gt;&gt; getUsers(<br>    @Query(&#39;page&#39;) int page,<br>    @Query(&#39;limit&#39;) int limit,<br>  );<br>  @POST(&#39;/users&#39;)<br>  Future&lt;UserResponse&gt; createUser(@Body() CreateUserRequest body);<br>  @PUT(&#39;/users/{id}&#39;)<br>  Future&lt;UserResponse&gt; updateUser(<br>    @Path(&#39;id&#39;) String userId,<br>    @Body() UpdateUserRequest body,<br>  );<br>  @DELETE(&#39;/users/{id}&#39;)<br>  Future&lt;void&gt; deleteUser(@Path(&#39;id&#39;) String userId);<br>  @GET(&#39;/users/{id}/projects&#39;)<br>  Future&lt;List&lt;ProjectResponse&gt;&gt; getUserProjects(<br>    @Path(&#39;id&#39;) String userId,<br>    @Header(&#39;Authorization&#39;) String token,<br>  );<br>}</pre><p>That’s the entire API client. Retrofit generates _UserApi — the actual implementation — in user_api.g.dart.</p><p>@GET, @POST, @PUT, @DELETE — HTTP methods. @Path — URL path parameters. {id} in the URL, @Path(&#39;id&#39;) on the parameter. @Query — URL query parameters. ?page=1&amp;limit=20. @Body() — request body. Serialized to JSON automatically. @Header — adds a specific header to this request.</p><blockquote>Using The Generated API Client</blockquote><pre>class UserApiService {<br>  late final UserApi _api;<br><br>UserApiService(Dio dio) {<br>    _api = UserApi(dio);<br>  }<br>  Future&lt;UserResponse&gt; getUser(String userId) =&gt; _api.getUser(userId);<br>  Future&lt;List&lt;UserResponse&gt;&gt; getUsers({int page = 1, int limit = 20}) =&gt;<br>      _api.getUsers(page, limit);<br>  Future&lt;UserResponse&gt; createUser(CreateUserRequest request) =&gt;<br>      _api.createUser(request);<br>}</pre><p>Clean. Type safe. The Dio configuration (interceptors, base headers, timeouts) goes in the Dio instance you pass to the constructor — not scattered across every API method.</p><blockquote>Running The Generator</blockquote><p>This is the command you’ll run every time you add or modify an annotated class:</p><pre># Run once — generates files and stops<br>flutter pub run build_runner build<br><br># Or with the newer dart command<br>dart run build_runner build<br># If you get conflicts with existing generated files<br>dart run build_runner build --delete-conflicting-outputs</pre><p>The --delete-conflicting-outputs flag is your best friend. Run it when build_runner complains about existing files. It deletes the old generated files and creates fresh ones.</p><blockquote>Watch Mode — For Active Development</blockquote><pre>dart run build_runner watch</pre><p>Watch mode runs continuously and regenerates files automatically whenever you save a change. Use this when you’re actively adding new models or endpoints. Stop it when you’re not — it uses resources.</p><blockquote>The .g.dart Files — What They Actually Are</blockquote><p>After running the generator, every file with part &#39;filename.g.dart&#39; gets a companion generated file. Here&#39;s what user_response.g.dart actually looks like:</p><pre>// GENERATED CODE - DO NOT MODIFY BY HANDThis is exactly what you would have written by hand. Just written by a machine, perfectly, every time. Never touch this file. Never edit it. It gets regenerated and your changes disappear.<br>part of &#39;user_response.dart&#39;;<br>// **************************************************************************<br>// JsonSerializableGenerator<br>// **************************************************************************<br>UserResponse _$UserResponseFromJson(Map&lt;String, dynamic&gt; json) =&gt; UserResponse(<br>      id: json[&#39;id&#39;] as String,<br>      name: json[&#39;name&#39;] as String,<br>      email: json[&#39;email&#39;] as String,<br>      avatar: json[&#39;avatar&#39;] as String?,<br>    );<br>Map&lt;String, dynamic&gt; _$UserResponseToJson(UserResponse instance) =&gt;<br>    &lt;String, dynamic&gt;{<br>      &#39;id&#39;: instance.id,<br>      &#39;name&#39;: instance.name,<br>      &#39;email&#39;: instance.email,<br>      &#39;avatar&#39;: instance.avatar,<br>    };</pre><blockquote>Should You Commit .g.dart Files?</blockquote><p>Yes. Commit them.</p><p>Some developers .gitignore them. The argument is they&#39;re generated so they don&#39;t need to be in version control.</p><p>The problem — when someone clones your repo and tries to build without running the generator first, they get compile errors immediately. Every new developer on the team has to know to run dart run build_runner build before they can even start. And CI/CD pipelines need the generator to run before building.</p><p>Commit the .g.dart files. Everyone can build immediately. No extra steps. No confusion.</p><blockquote>Things That Will Catch You Out</blockquote><p><strong>“Target of URI hasn’t been generated” error</strong> — you added part &#39;filename.g.dart&#39; but haven&#39;t run the generator yet. Run dart run build_runner build. The error disappears.</p><p><strong>Build runner conflict errors</strong> — generated files from a previous run conflict with new generation. Run dart run build_runner build --delete-conflicting-outputs. Done.</p><p><strong>Nested objects not parsing</strong> — the nested class doesn’t have @JsonSerializable() or doesn&#39;t have a fromJson factory. Every class in the chain needs it.</p><p><strong>Missing </strong><strong>part statement</strong> — you added @JsonSerializable() but forgot part &#39;filename.g.dart&#39;. The generator won&#39;t produce output without it.</p><p><strong>Retrofit not finding the implementation</strong> — part &#39;api_file.g.dart&#39; is missing, or the generator hasn&#39;t been run since you modified the interface. Run the generator.</p><p><strong>Watch mode not picking up changes</strong> — sometimes watch mode misses changes. Stop it, run build --delete-conflicting-outputs once, then start watch mode again.</p><blockquote>Quick Checklist</blockquote><ul><li>✅ json_annotation in dependencies, json_serializable and build_runner in dev_dependencies</li><li>✅ part &#39;filename.g.dart&#39; in every file with annotations</li><li>✅ @JsonSerializable() on every model class</li><li>✅ fromJson factory and toJson method in every model</li><li>✅ Nested objects also have @JsonSerializable()</li><li>✅ Run dart run build_runner build --delete-conflicting-outputs after any changes</li><li>✅ .g.dart files committed to version control</li><li>✅ Use watch mode during active development</li></ul><p>Code generation feels like magic the first time you use it. Then it feels like the obvious way to do things and you wonder how you ever did it manually.</p><p>Stop writing fromJson by hand. You have better things to do.</p><p><em>— Shivani Bagal</em> 🤍,</p><p><em>who will never manually write a fromJson method again and has made her peace with that</em></p><p><em>“Questions about setting up build_runner in a specific project structure or hitting a weird error? Drop it in the comments — build_runner errors look scary but almost always have a simple fix.”</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7d2e2e78dce" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Localization — Set It Up Now So You Don’t Cry Later]]></title>
            <link>https://medium.com/@shivanibagal88/flutter-localization-set-it-up-now-so-you-dont-cry-later-082ae3adb4d9?source=rss-3574cdf35e31------2</link>
            <guid isPermaLink="false">https://medium.com/p/082ae3adb4d9</guid>
            <category><![CDATA[flutter-localization]]></category>
            <dc:creator><![CDATA[Shivani Bagal]]></dc:creator>
            <pubDate>Thu, 13 Aug 2026 09:41:13 GMT</pubDate>
            <atom:updated>2026-08-13T09:41:13.622Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0rPza0slvL51VqeS-jUK7Q.png" /></figure><p>Here’s a scenario that has happened to more developers than will admit it.</p><p>Client asks “can we add Hindi support?” Six months into the app. Every string in the app is hardcoded directly in the widgets. Hundreds of files. Thousands of strings scattered everywhere with no system.</p><p>The answer is technically yes. The actual work is rewriting a significant portion of your app. The timeline becomes uncomfortable. Everyone is unhappy.</p><p>This is completely avoidable. And the way you avoid it is by setting up localization properly from day one — even if you only support English right now. Even if you never add another language. Because the setup takes a few hours once, and retrofitting it later takes days.</p><p>I set it up in my apps even when the requirement was English only. Because I’ve seen what happens when you don’t and then someone asks.</p><p>This is how you do it properly.</p><blockquote>What Flutter Localization Actually Is</blockquote><p>Localization (l10n) is the process of making your app adaptable to different languages and regions. Instead of writing Text(&#39;Submit&#39;) directly in your widget — you write Text(context.l10n.submit) and the actual string comes from a language file.</p><p>English? Loads the English file. Hindi? Loads the Hindi file. Same code, different strings, same app.</p><p>Flutter’s official localization system uses:</p><p><strong>ARB files</strong> (Application Resource Bundle) — JSON-like files that contain your translated strings. One file per language. app_en.arb for English, app_hi.arb for Hindi.</p><p><strong>Code generation</strong> — Flutter generates Dart classes from your ARB files. You get type-safe access to all your strings. No magic strings, no typos, compile-time safety.</p><p><strong>flutter_localizations</strong> — the package that provides built-in localized widgets. Things like date pickers, form validation messages, Material and Cupertino widget labels — all localized automatically.</p><blockquote>The Packages</blockquote><pre>dependencies:<br>  flutter:<br>    sdk: flutter<br>  flutter_localizations:<br>    sdk: flutter<br>  intl: ^0.19.0</pre><pre>flutter:<br>  generate: true  # This is required — enables code generation</pre><p>flutter_localizations — comes with Flutter, just needs to be declared as a dependency.</p><p>intl — the internationalization package. Handles date formatting, number formatting, plural rules, and more.</p><p>generate: true — this line in your flutter section is what tells Flutter to generate the localization Dart files. Without it — nothing gets generated. Very easy to miss. Add it.</p><blockquote>Step 1 — Create l10n.yaml</blockquote><p>Create a file called l10n.yaml at the root of your project (same level as pubspec.yaml):</p><pre>arb-dir: lib/l10n<br>template-arb-file: app_en.arb<br>output-localization-file: app_localizations.dart</pre><p>arb-dir — where your ARB files live. template-arb-file — your default language file. This is the one you edit most. output-localization-file — the name of the generated Dart file.</p><blockquote>Step 2 — Create Your ARB Files</blockquote><p>Create the folder lib/l10n/ and add your template file app_en.arb:</p><pre>{<br>  &quot;@@locale&quot;: &quot;en&quot;,<br><br>&quot;appTitle&quot;: &quot;My App&quot;,<br>  &quot;@appTitle&quot;: {<br>    &quot;description&quot;: &quot;The title of the application&quot;<br>  },<br>  &quot;submit&quot;: &quot;Submit&quot;,<br>  &quot;@submit&quot;: {<br>    &quot;description&quot;: &quot;Submit button label&quot;<br>  },<br>  &quot;cancel&quot;: &quot;Cancel&quot;,<br>  &quot;@cancel&quot;: {<br>    &quot;description&quot;: &quot;Cancel button label&quot;<br>  },<br>  &quot;welcome&quot;: &quot;Welcome, {name}!&quot;,<br>  &quot;@welcome&quot;: {<br>    &quot;description&quot;: &quot;Welcome message with user name&quot;,<br>    &quot;placeholders&quot;: {<br>      &quot;name&quot;: {<br>        &quot;type&quot;: &quot;String&quot;<br>      }<br>    }<br>  },<br>  &quot;itemCount&quot;: &quot;{count, plural, =0{No items} =1{1 item} other{{count} items}}&quot;,<br>  &quot;@itemCount&quot;: {<br>    &quot;description&quot;: &quot;Item count with plural support&quot;,<br>    &quot;placeholders&quot;: {<br>      &quot;count&quot;: {<br>        &quot;type&quot;: &quot;int&quot;<br>      }<br>    }<br>  }<br>}</pre><p>Every string has two entries — the actual string and a @key entry with metadata. The @ entries are for the code generator and for translators. The description tells translators what the string is used for.</p><p><strong>Placeholders</strong> — {name} in the string becomes a parameter in the generated method. context.l10n.welcome(userName) — type safe, compile checked.</p><p><strong>Plural support</strong> — {count, plural, ...} handles singular/plural automatically. itemCount(0) → &quot;No items&quot;, itemCount(1) → &quot;1 item&quot;, itemCount(5) → &quot;5 items&quot;.</p><blockquote>Step 3 — Add A Second Language (Optional But The Whole Point)</blockquote><p>If you want Hindi support — create lib/l10n/app_hi.arb:</p><pre>{<br>  &quot;@@locale&quot;: &quot;hi&quot;,<br>  &quot;appTitle&quot;: &quot;मेरा ऐप&quot;,<br>  &quot;submit&quot;: &quot;जमा करें&quot;,<br>  &quot;cancel&quot;: &quot;रद्द करें&quot;,<br>  &quot;welcome&quot;: &quot;स्वागत है, {name}!&quot;,<br>  &quot;itemCount&quot;: &quot;{count, plural, =0{कोई आइटम नहीं} =1{1 आइटम} other{{count} आइटम}}&quot;<br>}</pre><p>Same keys, different values. That’s it. Add the file — Flutter generates the Hindi translations automatically.</p><blockquote>Step 4 — Generate The Dart Files</blockquote><p>Run:</p><pre>flutter gen-l10n</pre><p>Or just run your app:</p><pre>flutter run</pre><p>Flutter automatically runs the generator when you run or build. The generated files appear in .dart_tool/flutter_gen/gen_l10n/. Don&#39;t edit these files — they get regenerated every time.</p><blockquote>Step 5 — Configure MaterialApp</blockquote><pre>import &#39;package:flutter_localizations/flutter_localizations.dart&#39;;<br>import &#39;package:flutter_gen/gen_l10n/app_localizations.dart&#39;;<br><br>class MyApp extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      title: &#39;My App&#39;,<br>      // Add these three:<br>      localizationsDelegates: const [<br>        AppLocalizations.delegate,<br>        GlobalMaterialLocalizations.delegate,<br>        GlobalWidgetsLocalizations.delegate,<br>        GlobalCupertinoLocalizations.delegate,<br>      ],<br>      supportedLocales: const [<br>        Locale(&#39;en&#39;), // English<br>        Locale(&#39;hi&#39;), // Hindi - add when you have the ARB file<br>      ],<br>      // Optional - force a specific locale for testing<br>      // locale: const Locale(&#39;hi&#39;),<br>      home: const HomeScreen(),<br>    );<br>  }<br>}</pre><p>AppLocalizations.delegate — your app&#39;s strings. GlobalMaterialLocalizations.delegate — Material widget strings (date picker labels, etc.) GlobalWidgetsLocalizations.delegate — text direction, RTL support. GlobalCupertinoLocalizations.delegate — iOS-style widget strings.</p><p>All four. Always all four. Missing one and you’ll get weird issues with date pickers or Material widgets not being localized properly.</p><blockquote>Step 6 — Using Strings In Your Widgets</blockquote><pre>import &#39;package:flutter_gen/gen_l10n/app_localizations.dart&#39;;<br><br>// Method 1 - using context extension<br>class MyWidget extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    final l10n = AppLocalizations.of(context)!;<br>    return Column(<br>      children: [<br>        Text(l10n.appTitle),<br>        Text(l10n.welcome(&#39;Shivani&#39;)), // With placeholder<br>        Text(l10n.itemCount(5)),        // With plural<br>        ElevatedButton(<br>          onPressed: () {},<br>          child: Text(l10n.submit),<br>        ),<br>      ],<br>    );<br>  }<br>}</pre><p>Type safe. If you delete a key from the ARB file and try to use it — compile error. Not a runtime crash. Not a missing string at 11pm during testing. A compile error that you catch immediately.</p><p>This is why localization from day one is worth it even if you only have one language.</p><blockquote>Adding A Convenient Extension</blockquote><p>Add this extension so you can write context.l10n.submit instead of AppLocalizations.of(context)!.submit:</p><pre>// lib/l10n/l10n_extension.dart<br>import &#39;package:flutter/widgets.dart&#39;;<br>import &#39;package:flutter_gen/gen_l10n/app_localizations.dart&#39;;<br><br>extension AppLocalizationsX on BuildContext {<br>  AppLocalizations get l10n =&gt; AppLocalizations.of(this)!;<br>}</pre><p>Now in any widget:</p><pre>Text(context.l10n.submit)<br>Text(context.l10n.welcome(&#39;Shivani&#39;))</pre><p>Much cleaner. Much less typing. Use this pattern.</p><blockquote>The intl_utils Package — Optional But Useful</blockquote><p>You have intl_utils in your pubspec. This package adds extra tooling for localization — it can generate ARB files from your Dart code and sync strings across languages automatically.</p><pre>dev_dependencies:<br>  intl_utils: ^2.8.7</pre><p>With intl_utils, you can run:</p><pre>flutter pub run intl_utils:generate</pre><p>This syncs your ARB files — if you add a new string to the English ARB, it adds placeholder entries to all other language ARBs automatically so nothing gets missed.</p><p>For teams with multiple developers adding strings — very useful. For solo projects — the manual approach is fine.</p><h3>What Your Folder Structure Looks Like</h3><pre>lib/<br>├── l10n/<br>│   ├── app_en.arb          ← English strings (template)<br>│   ├── app_hi.arb          ← Hindi strings (when ready)<br>│   └── l10n_extension.dart ← context.l10n shorthand<br>├── main.dart<br>└── ...<br><br>l10n.yaml                   ← Configuration file<br>pubspec.yaml                ← generate: true must be here</pre><p>Clean. Everything in one place. Adding a new language means creating one new ARB file.</p><blockquote>Why Even Bother If You Only Have English</blockquote><p>Because adding localization later is painful and adding it now is a few hours.</p><p>Here’s what happens when you add localization to an existing app that didn’t have it:</p><p>You search for every hardcoded string in every file. You move it to the ARB file. You update the reference. For an app with hundreds of screens — that’s days of work with real risk of missing strings.</p><p>Here’s what happens when you set it up from day one even for English only:</p><p>You add strings to the ARB file as you build. Every new screen automatically uses context.l10n.something. When the client asks for Hindi six months later — you create app_hi.arb, translate the strings, add Locale(&#39;hi&#39;) to your supported locales, done.</p><p>Hours of work. Not days.</p><p>And if nobody ever asks for a second language — you’ve lost nothing. Your strings are organized, your code is cleaner, and you have the satisfaction of knowing your app is ready for it.</p><p><em>— Shivani Bagal</em>🤍<em>,</em></p><p><em>who set up localization on an English-only app and slept better knowing it was ready</em></p><p><em>“Got a client asking for multi-language support on an existing app without localization setup? I feel your pain. Drop it in the comments — there’s a migration path and it’s not as bad as it looks.”</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=082ae3adb4d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>