<?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 Champani Hamy on Medium]]></title>
        <description><![CDATA[Stories by Champani Hamy on Medium]]></description>
        <link>https://medium.com/@champs_hamy?source=rss-1170b5949840------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*j5bKjg05rXa0BwREff158Q.jpeg</url>
            <title>Stories by Champani Hamy on Medium</title>
            <link>https://medium.com/@champs_hamy?source=rss-1170b5949840------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 13:35:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@champs_hamy/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Use BoxShadow in Flutter to Creating Depth and Realism in Your UI]]></title>
            <link>https://medium.com/@champs_hamy/how-to-use-boxshadow-in-flutter-to-creating-depth-and-realism-in-your-ui-75a1e4af22b2?source=rss-1170b5949840------2</link>
            <guid isPermaLink="false">https://medium.com/p/75a1e4af22b2</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Champani Hamy]]></dc:creator>
            <pubDate>Fri, 07 Nov 2025 09:51:24 GMT</pubDate>
            <atom:updated>2025-11-11T06:12:55.828Z</atom:updated>
            <content:encoded><![CDATA[<p>Box shadows exist to create <strong>visual hierarchy and depth</strong> in user interfaces.</p><p>In the real world, everything has <strong>depth, light, and shadow</strong>. Flat elements on a screen don’t — so box shadows simulate<em> </em>that depth to help users instantly understand <strong>which element is “above” or “interactive.”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*e9aymds6GgzFNMVZjLa6Mw.gif" /></figure><p>If you are not a medium member, read full article <a href="https://medium.com/@champs_hamy/how-to-use-boxshadow-in-flutter-to-creating-depth-and-realism-in-your-ui-75a1e4af22b2?source=friends_link&amp;sk=4708bba75a0beae2eab386dfc996d18f">here</a>.</p><h4>What is BoxShadow?</h4><p>In Flutter, a <strong>BoxShadow</strong> is used to draw a drop shadow around a widget — usually inside a Container’s BoxDecoration</p><p>It’s defined like this:</p><pre>BoxShadow({<br>  Color color = const Color(0xFF000000),<br>  Offset offset = Offset.zero,<br>  double blurRadius = 0.0,<br>  double spreadRadius = 0.0,<br>  BlurStyle blurStyle = BlurStyle.normal,<br>})</pre><p>Now, let’s break down parameters:</p><h4>1. Color</h4><p>The color of the shadow. You can control transparency using .withOpacity(x)</p><pre>color: Colors.black.withOpacity(0.3),</pre><p>This gives a softer, realistic shadow.</p><h4>2. Offset (Offset(dx, dy))</h4><p>This controls <strong>where the shadow is positioned relative to the widget</strong>.</p><pre>Offset(double dx, double dy)</pre><p>So think of it like a <strong>2D vector</strong>:</p><ul><li><strong>dx</strong> → X-axis shift (positive = right, negative = left)</li><li><strong>dy</strong> → Y-axis shift (positive = down, negative = up)</li></ul><p>Origin (0, 0) is at the <strong>top-left corner</strong> of the coordinate space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*wPMnGgDITAORZEY4ucV-fA.png" /><figcaption>Offset</figcaption></figure><h4>3. Blur Radius</h4><p>This controls how <strong>soft or sharp</strong> the shadow edges are.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2YvVHx5Io0QcBfno3OI2Fw.png" /><figcaption>Variants of Blur Radius</figcaption></figure><pre>| Value                       | Effect                    |<br>| ----------------------------| ------------------------- |<br>| `0`                         | Sharp edge shadow (hard)  |<br>| `5`                         | Slightly blurred          |<br>| `15`                        | Smooth soft shadow        |<br>| `30+`                       | Very soft, diffuse shadow |</pre><h4>4. Spread Radius</h4><p>This controls <strong>how large or small</strong> the shadow area is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l3jploE6YNYl77hnYSyjow.png" /><figcaption>Variants of Spread Radius</figcaption></figure><pre>| Value                     | Effect                        |<br>| --------------------------| ----------------------------- |<br>| `0`                       | Normal shadow size            |<br>| `5`                       | Expands outward (bigger area) |<br>| `-5`                      | Shrinks inward (tight shadow) |</pre><p>Now let’s look at an example.</p><p>Full code with sliders available <a href="https://github.com/ChampaniUdayangani/flutter_animations_master/tree/193f2784d38b7515f3811bb8a42f131574a5213f/lib/examples">here</a> on Github.</p><pre>Container(<br>    width: 400,<br>    height: 400,<br>    child: Center(<br>    child: Container(<br>       decoration: BoxDecoration(<br>         color: Colors.white,<br>         borderRadius: BorderRadius.circular(16),<br>         boxShadow: [<br>           BoxShadow(<br>              color: Colors.black.withOpacity(0.3),<br>              offset: Offset(10, 10),<br>              blurRadius: 10.0,<br>              spreadRadius: 2.0,<br>           ),<br>          ],<br>        ),<br>        padding: const EdgeInsets.all(8),<br>        child: Image.network(<br>           &#39;https://avatars.githubusercontent.com/u/583231?v=4&#39;,<br>           width: 200,<br>        ),<br>    ),<br>  ),<br> ),</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QWVz2BVifMIAf5-CZ1Luxg.png" /></figure><h3>Happy coding!</h3><h3>💬 Let’s chat!</h3><p>Got any questions ? Drop them in the comments!</p><p>🖱️ <strong>Follow me on Medium</strong> to get more tech content like this.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75a1e4af22b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Daily Task Tracker with Supabase and Flutter: A Complete Guide]]></title>
            <link>https://blog.stackademic.com/building-a-daily-task-tracker-with-supabase-and-flutter-a-complete-guide-9d463c642121?source=rss-1170b5949840------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d463c642121</guid>
            <category><![CDATA[supabase]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Champani Hamy]]></dc:creator>
            <pubDate>Fri, 31 Oct 2025 08:18:45 GMT</pubDate>
            <atom:updated>2025-10-31T08:18:45.861Z</atom:updated>
            <content:encoded><![CDATA[<h4>Learn how to create a fully functional task management app with all CRUD operations using Supabase as your backend.</h4><p>In this comprehensive tutorial, we’ll build a daily task tracking application from scratch using Flutter and Supabase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gbWkk3uu0_KzMfnFXy-n7w.jpeg" /></figure><p>This app will demonstrate all the essential CRUD (Create, Read, Update, Delete) operations, allowing users to fetch their daily tasks, add new ones, update existing tasks, and delete completed ones.</p><p>If you prefer video tutorial, check this out.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F48NlBNt1wlM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D48NlBNt1wlM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F48NlBNt1wlM%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c6eccbd49b89bd6891f15918048b97af/href">https://medium.com/media/c6eccbd49b89bd6891f15918048b97af/href</a></iframe><p>By the end of this guide, you’ll have a solid understanding of integrating Supabase with Flutter for real-time data management.</p><h3>Step 1: Create a New Supabase Project</h3><p>First, let’s set up our backend infrastructure. Head over to <a href="https://supabase.com/">supabase.com</a> and create a new project. Supabase provides a generous free tier that’s perfect for learning and small applications. Give your project a meaningful name and choose a secure database password — you’ll need this later.</p><h3>Step 2: Add the Flutter Package</h3><p>To communicate with Supabase from our Flutter application, we need to install the official supabase_flutter package. Add it to your pubspec.yaml file:</p><pre>dependencies:<br>  supabase_flutter: ^latest_version</pre><p>Run flutter pub get to install the package.</p><h3>Step 3: Set Up the Project Structure</h3><p>Let’s start with a basic Flutter app structure.</p><p>We’ll create a simple home screen that will eventually display our tasks (home_screen.dart):</p><pre>class HomeScreen extends StatelessWidget {<br>  const HomeScreen({super.key});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(body: Center(child: Text(&quot;Let&#39;s build daily task app&quot;)));<br>  }<br><br>}</pre><p>And our main application widget (main.dart):</p><pre>void main() async{<br>  runApp(const MyApp());<br>}<br><br><br>class MyApp extends StatelessWidget {<br>  const MyApp({super.key});<br><br>  // This widget is the root of your application.<br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      debugShowCheckedModeBanner: false,<br>      title: &#39;Flutter Demo&#39;,<br>      theme: ThemeData(<br>        colorScheme: ColorScheme.fromSeed(seedColor: Colors.teal),<br>      ),<br>      home: HomeScreen(),<br>    );<br>  }<br>}</pre><h3>Step 4: Initialize Supabase</h3><p>Before we can use any Supabase features, we need to initialize the Supabase client in our app. You’ll find your project’s URL and anon key in the “Project Overview” → “Project APIs” section of your Supabase dashboard.</p><pre>void main() async{<br>  WidgetsFlutterBinding.ensureInitialized();<br>  await Supabase.initialize(<br>    url: url,<br>    anonKey: anonKey,<br>  );<br><br>//...<br>}</pre><p><strong>Important:</strong> The WidgetsFlutterBinding.ensureInitialized() call is crucial because we&#39;re performing asynchronous operations before running the app. The url and anonKey should be replaced with your actual Supabase project credentials.</p><h3>Step 5: Create the Database Table</h3><p>Now let’s set up our data structure in Supabase:</p><ol><li>Navigate to the “Table Editor” in your Supabase dashboard</li><li>Click “Create a new table”</li><li>Name the table tasks</li><li><strong>Important:</strong> Keep “Row Level Security” (RLS) enabled — this is a critical security feature</li></ol><p>Your table should have the following columns (Supabase auto-creates id and created_at):</p><ul><li>id (int8, primary key, auto-increment)</li><li>task (text) - stores the task description</li><li>isDone (boolean) - tracks completion status</li><li>created_at (timestamp)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7OGC0QoUt-Nk313OW0wUDg.png" /><figcaption>Database table creation in Supabase</figcaption></figure><h3>Step 6: Configure Row Level Security (RLS) Policies</h3><p>This is a critical step! Even though we’ve created the table, our app won’t be able to read or write data until we set up the proper RLS policies. Without these policies, all your API calls will fail with permission errors.</p><h4>Why RLS Policies Matter ?</h4><p>Row Level Security is Supabase’s way of controlling who can access what data. By default, when RLS is enabled, <strong>nobody</strong> can access the table — not even with the anon key. We need to explicitly grant permissions.</p><h4>Setting Up Policies for Anonymous Access</h4><p>Since this is a simple task app without authentication, we’ll create policies that allow anyone to perform all operations. Here’s how:</p><ol><li><strong>Navigate to Authentication → Policies</strong> in your Supabase dashboard</li><li>Find your tasks table</li><li>Click <strong>“New Policy”</strong></li></ol><h4>Create Four Essential Policies</h4><p><strong>Policy 1: Enable Read Access (SELECT)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YnG3qvu17ZwBKnl8kK_POw.png" /><figcaption>Read policy in Supabase</figcaption></figure><p>This policy allows anyone to fetch tasks from the database.</p><p><strong>Policy 2: Enable Insert Access (INSERT)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RIKyHvsrRz2GWaYDV3Frjg.png" /><figcaption>Write policy in Supabase</figcaption></figure><p>This policy allows anyone to create new tasks.</p><p><strong>Policy 3: Enable Update Access (UPDATE)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zNWI9Qq7u-Z8CuQSG5JgtA.png" /><figcaption>Update policy in Supabase</figcaption></figure><p>This policy allows anyone to update existing tasks.</p><p><strong>Policy 4: Enable Delete Access (DELETE)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eqE9UA4J9ccO0JQ1DmQeKg.png" /><figcaption>Delete policy in Supabase</figcaption></figure><p>This policy allows anyone to delete tasks.</p><h4>Verify Your Policies</h4><p>After creating the policies, verify them:</p><ol><li>Go back to <strong>Authentication → Policies</strong></li><li>Select your tasks table</li><li>You should see all four policies listed with green checkmarks</li></ol><h4>Understanding the Policy Syntax</h4><ul><li><strong>USING (true)</strong>: The condition that determines which rows can be selected, updated, or deleted. true means all rows</li><li><strong>WITH CHECK (true)</strong>: The condition that validates insert and update operations. true means all operations are allowed</li></ul><h3>Step 7: Create the Task Model</h3><p>To work with our data efficiently, we’ll create a Task model class that handles the conversion between Dart objects and database records:</p><pre>class Task {<br>  final int? id;<br>  final String task;<br>  final bool isDone;<br><br>  Task({<br>      this.id,<br>      required this.task,<br>      required this.isDone,<br>    });<br>    // Convert database map to Task object<br>    factory Task.fromMap(Map&lt;String, dynamic&gt; map) {<br>      return Task(<br>        id: map[&#39;id&#39;],<br>        task: map[&#39;task&#39;],<br>        isDone: map[&#39;isDone&#39;],<br>      );<br>    }<br>    // Convert Task object to database map<br>    Map&lt;String, dynamic&gt; toMap() {<br>      return {<br>        &#39;task&#39;: task,<br>        &#39;isDone&#39;: isDone,<br>      };<br>    }<br>}</pre><p>The fromMap factory constructor deserializes data from Supabase, while toMap prepares our data for database operations.</p><h3>Step 8: Create the Database Service</h3><p>This is where the magic happens. Our DatabaseService class encapsulates all database operations, providing a clean interface for our UI to interact with Supabase.</p><pre>class DatabaseService {<br>  // to get access to supabase services, we need the supabase client.<br>  final supabase = Supabase.instance.client;<br>  final table = &quot;tasks&quot;;<br><br>  // fetch data<br>  Future&lt;List&lt;Task&gt;&gt; fetchData() async {<br>    final data = await supabase.from(table).select();<br>    return data.map((e) =&gt; Task.fromMap(e)).toList();<br>  }<br>  // insert data<br>  Future&lt;void&gt; insertRow(Task newTask) async {<br>    await supabase.from(table).insert(newTask.toMap());<br>  }<br>  // update data<br>  Future&lt;void&gt; updateRow(Task updatedTask) async {<br>    await supabase<br>        .from(table)<br>        .update(updatedTask.toMap())<br>        .eq(&#39;id&#39;, updatedTask.id!);<br>  }<br>  // delete data<br>  Future&lt;void&gt; deleteRow({required int id}) async {<br>    await supabase.from(table).delete().eq(&#39;id&#39;, id);<br>  }<br>}</pre><h4>Understanding Each Database Function</h4><p><strong>fetchData() - Reading All Tasks</strong></p><pre>Future&lt;List&lt;Task&gt;&gt; fetchData() async {<br>  final data = await supabase.from(table).select();<br>  return data.map((e) =&gt; Task.fromMap(e)).toList();<br>}</pre><p>This function retrieves all tasks from the database. Here’s what happens:</p><ol><li>supabase.from(table) targets our &quot;<strong>tasks</strong>&quot; table</li><li>.select() fetches all rows (similar to SELECT * FROM tasks in SQL)</li><li>The returned data is a list of maps</li><li>We use .map() to convert each map into a Task object using our fromMap constructor</li><li>Finally, .toList() converts the iterable into a concrete list</li></ol><p>Call this when the app loads and after any modification to keep the UI in sync with the database.</p><p><strong>insertRow() - Creating New Tasks</strong></p><pre>Future&lt;void&gt; insertRow(Task newTask) async {<br>  await supabase.from(table).insert(newTask.toMap());<br>}</pre><p>This function adds a new task to the database. Here’s the process:</p><ol><li>We receive a Task object with the new task details</li><li>newTask.toMap() converts the Task object into a map that Supabase understands</li><li>.insert() adds the new row to the database</li><li>Supabase automatically handles the id generation and created_at timestamp</li></ol><p>The task object we pass in should not have an id set—Supabase generates this automatically.</p><p><strong>updateRow() - Modifying Existing Tasks</strong></p><pre>Future&lt;void&gt; updateRow(Task updatedTask) async {<br>  await supabase<br>      .from(table)<br>      .update(updatedTask.toMap())<br>      .eq(&#39;id&#39;, updatedTask.id!);<br>}</pre><p>This function modifies an existing task. Let’s break it down:</p><ol><li>.update(updatedTask.toMap()) specifies what data to change</li><li>.eq(&#39;id&#39;, updatedTask.id!) acts as a WHERE clause—it identifies which row to update by matching the ID</li><li>The ! operator asserts that the ID is not null (we should only update existing tasks)</li></ol><p>Without the .eq() filter, this would attempt to update ALL rows in the table—a dangerous operation! The .eq() method ensures we only modify the specific task we intend to change.</p><p><strong>deleteRow() - Removing Tasks</strong></p><pre>Future&lt;void&gt; deleteRow({required int id}) async {<br>  await supabase.from(table).delete().eq(&#39;id&#39;, id);<br>}</pre><p>This function removes a task from the database:</p><ol><li>.delete() initiates a delete operation</li><li>.eq(&#39;id&#39;, id) specifies which row to delete by matching the ID</li><li>Only the task with the matching ID is removed</li></ol><p>Always use a WHERE clause (.eq()) with delete operations to avoid accidentally deleting all your data!</p><h3>Step 9: Build the User Interface</h3><p>Now let’s create a fully functional UI that brings everything together:</p><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:tasks/database_service.dart&#39;;<br>import &#39;package:tasks/storage_service.dart&#39;;<br>import &#39;package:tasks/task.dart&#39;;<br><br>class HomeScreen extends StatefulWidget {<br>  const HomeScreen({super.key});<br><br>  @override<br>  State&lt;HomeScreen&gt; createState() =&gt; _HomeScreenState();<br>}<br><br>class _HomeScreenState extends State&lt;HomeScreen&gt; {<br>  final databaseService = DatabaseService();<br>  final storageService = StorageService();<br>  List&lt;Task&gt; tasks = [];<br>  bool? isDone;<br>  TextEditingController _taskNameController = TextEditingController();<br><br>  // fetch<br>  Future&lt;void&gt; _fetchData() async {<br>    final data = await databaseService.fetchData();<br>    setState(() {<br>      tasks = data;<br>    });<br>  }<br><br>  // insert<br>  Future&lt;void&gt; _insertData() async {<br>    final task = Task(task: _taskNameController.text, isDone: false);<br>    await databaseService.insertRow(task);<br>  }<br><br>  // update<br>  Future&lt;void&gt; _updateData(Task task) async {<br>    final updatedTask = Task(<br>      id: task.id,<br>      task: _taskNameController.text.isEmpty<br>          ? task.task<br>          : _taskNameController.text,<br>      isDone: isDone!,<br>    );<br>    await databaseService.updateRow(updatedTask);<br>  }<br><br>  // delete<br>  Future&lt;void&gt; _deleteData(int id) async {<br>    await databaseService.deleteRow(id: id);<br>  }<br><br>  @override<br>  void initState() {<br>    WidgetsBinding.instance.addPostFrameCallback((_) async {<br>      await _fetchData();<br>    });<br>    super.initState();<br>  }<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      appBar: AppBar(title: Text(&quot;My Daily Tasks&quot;)),<br>      body: tasks.isNotEmpty<br>          ? Padding(<br>              padding: const EdgeInsets.symmetric(horizontal: 20.0),<br>              child: ListView.builder(<br>                itemCount: tasks.length,<br>                itemBuilder: (context, index) {<br>                  final currentTask = tasks[index];<br>                  isDone = currentTask.isDone;<br>                  return ListTile(<br>                    title: Text(currentTask.task),<br>                    leading: Checkbox(<br>                      value: isDone,<br>                      onChanged: (v) async {<br>                        setState(() {<br>                          isDone = v;<br>                        });<br><br>                        await _updateData(currentTask);<br>                        await _fetchData();<br>                      },<br>                    ),<br>                    trailing: SizedBox(<br>                      width: 100,<br>                      child: Row(<br>                        children: [<br>                          IconButton(<br>                            onPressed: () {<br>                              setState(() {<br>                                _taskNameController.text = currentTask.task;<br>                              });<br>                              showDialog(<br>                                context: context,<br>                                builder: (updateDialogContext) {<br>                                  return AlertDialog(<br>                                    content: SizedBox(<br>                                      width: 300,<br>                                      height: 100,<br>                                      child: TextField(<br>                                        controller: _taskNameController,<br>                                      ),<br>                                    ),<br>                                    actions: [<br>                                      // add<br>                                      FilledButton(<br>                                        onPressed: () async {<br>                                          await _updateData(currentTask);<br>                                          await _fetchData();<br>                                          Navigator.of(<br>                                            updateDialogContext,<br>                                          ).pop();<br>                                          setState(() {<br>                                            _taskNameController.text = &#39;&#39;;<br>                                          });<br>                                        },<br>                                        child: Text(&quot;Update&quot;),<br>                                      ),<br>                                      // cancel<br>                                      OutlinedButton(<br>                                        onPressed: () {<br>                                          Navigator.of(<br>                                            updateDialogContext,<br>                                          ).pop();<br>                                          setState(() {<br>                                            _taskNameController.text = &#39;&#39;;<br>                                          });<br>                                        },<br>                                        child: Text(&quot;Cancel&quot;),<br>                                      ),<br>                                    ],<br>                                  );<br>                                },<br>                              );<br>                            },<br>                            icon: Icon(Icons.edit),<br>                          ),<br>                          IconButton(<br>                            onPressed: () async {<br>                              await _deleteData(currentTask.id!);<br>                              await _fetchData();<br>                            },<br>                            icon: Icon(Icons.delete),<br>                          ),<br>                        ],<br>                      ),<br>                    ),<br>                  );<br>                },<br>              ),<br>            )<br>          : Center(child: Text(&quot;No tasks yet&quot;)),<br>      floatingActionButton: FloatingActionButton(<br>        onPressed: () {<br>          showDialog(<br>            context: context,<br>            builder: (addDialogContext) {<br>              return AlertDialog(<br>                content: SizedBox(<br>                  width: 300,<br>                  height: 100,<br>                  child: TextField(controller: _taskNameController),<br>                ),<br>                actions: [<br>                  // add<br>                  FilledButton(<br>                    onPressed: () async {<br>                      await _insertData();<br>                      await _fetchData();<br>                      Navigator.of(addDialogContext).pop();<br><br>                      setState(() {<br>                        _taskNameController.text = &#39;&#39;;<br>                      });<br>                    },<br>                    child: Text(&quot;Add&quot;),<br>                  ),<br>                  // cancel<br>                  OutlinedButton(<br>                    onPressed: () {<br>                      Navigator.of(addDialogContext).pop();<br>                      setState(() {<br>                        _taskNameController.text = &#39;&#39;;<br>                      });<br>                    },<br>                    child: Text(&quot;Cancel&quot;),<br>                  ),<br>                ],<br>              );<br>            },<br>          );<br>        },<br>        child: Icon(Icons.add),<br>      ),<br>    );<br>  }<br>}</pre><h3>Understanding the UI Implementation</h3><p><strong>State Management Variables</strong></p><pre>final databaseService = DatabaseService();<br>List&lt;Task&gt; tasks = [];<br>bool? isDone;<br>TextEditingController _taskNameController = TextEditingController();</pre><ul><li>databaseService: Our single source of truth for all database operations</li><li>tasks: Holds the current list of tasks displayed in the UI</li><li>isDone: Tracks the checkbox state for task completion</li><li>_taskNameController: Manages the text input in dialogs</li></ul><h4>Loading Data on Startup</h4><pre>@override<br>void initState() {<br>  WidgetsBinding.instance.addPostFrameCallback((_) async {<br>    await _fetchData();<br>  });<br>  super.initState();<br>}</pre><p>The addPostFrameCallback ensures that we fetch data after the first frame is rendered, preventing any build-time errors.</p><p><strong>UI Operation Wrappers</strong></p><p>Each UI operation wraps our database service methods and handles state updates:</p><ul><li><strong>_fetchData()</strong>: Retrieves all tasks and updates the UI state</li><li><strong>_insertData()</strong>: Creates a new task from the text controller input</li><li><strong>_updateData()</strong>: Modifies either the task text or completion status</li><li><strong>_deleteData()</strong>: Removes a task and refreshes the list</li></ul><p><strong>Interactive Features</strong></p><ol><li><strong>Checkbox</strong>: Toggles task completion status and immediately updates the database</li><li><strong>Edit Button</strong>: Opens a dialog pre-filled with the current task text</li><li><strong>Delete Button</strong>: Removes the task with confirmation through immediate action</li><li><strong>Floating Action Button</strong>: Opens a dialog to add new tasks</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AG-_FSsX-dEm-4qlpMBS0g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DnXH-xCXRKjiAvun8-ChXA.png" /><figcaption>Final App</figcaption></figure><h3>Key Takeaways</h3><ol><li><strong>Separation of Concerns</strong>: The DatabaseService class isolates all database logic, making your code more maintainable and testable.</li><li><strong>Error Handling</strong>: In production, you should wrap database calls in try-catch blocks to handle network failures and other exceptions gracefully.</li><li><strong>Row Level Security</strong>: Always keep RLS enabled and configure appropriate policies in Supabase to protect your data.</li></ol><p>While this tutorial uses manual fetching, Supabase supports <strong>real-time subscriptions</strong> for automatic UI updates. Read this article to learn when you can use realtime feature.</p><p><a href="https://medium.com/@champs_hamy/realtime-isnt-always-right-how-to-decide-if-your-app-truly-needs-instant-data-6be276c45e23">Realtime Isn’t Always Right: How to Decide If Your App Truly Needs Instant Data</a></p><h3>Conclusion</h3><p>You’ve now built a complete CRUD application using Flutter and Supabase! This foundation can be extended to build much more complex applications. The pattern we’ve established — separating database logic into a service class and maintaining clean state management — scales well as your application grows.</p><p>Happy coding!</p><h3>A message from our Founder</h3><p><strong>Hey, </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>Sunil</strong></a><strong> here.</strong> I wanted to take a moment to thank you for reading until the end and for being a part of this community.</p><p>Did you know that our team run these publications as a volunteer effort to over 3.5m monthly readers? <strong>We don’t receive any funding, we do this to support the community. ❤️</strong></p><p>If you want to show some love, please take a moment to <strong>follow me on </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>LinkedIn</strong></a><strong>, </strong><a href="https://tiktok.com/@messyfounder"><strong>TikTok</strong></a>, <a href="https://instagram.com/sunilsandhu"><strong>Instagram</strong></a>. You can also subscribe to our <a href="https://newsletter.plainenglish.io/"><strong>weekly newsletter</strong></a>.</p><p>And before you go, don’t forget to <strong>clap</strong> and <strong>follow</strong> the writer️!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d463c642121" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/building-a-daily-task-tracker-with-supabase-and-flutter-a-complete-guide-9d463c642121">Building a Daily Task Tracker with Supabase and Flutter: A Complete Guide</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Flutter Layout: A Deep Dive]]></title>
            <link>https://medium.com/@champs_hamy/mastering-flutter-layout-a-deep-dive-626e58c292cc?source=rss-1170b5949840------2</link>
            <guid isPermaLink="false">https://medium.com/p/626e58c292cc</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Champani Hamy]]></dc:creator>
            <pubDate>Mon, 27 Oct 2025 08:01:57 GMT</pubDate>
            <atom:updated>2025-10-27T10:06:01.660Z</atom:updated>
            <content:encoded><![CDATA[<h4>Every Flutter dev struggles with layout — until they learn this</h4><blockquote><em>RenderFlex children have non-zero flex but incoming height constraints are unbounded.</em></blockquote><blockquote><em>Vertical viewport was given unbounded height.</em></blockquote><p>Sound familiar? These are among the most commonly searched and frequently encountered layout errors in Flutter.</p><p>And if you’ve found yourself repeatedly wrapping and unwrapping widgets just to make that red error box disappear — you’re definitely not alone.</p><p>But instead of guessing our way through fixes, let’s break down <em>why</em> these issues actually occur.<br>Once you truly understand how Flutter’s layout system works — <strong>constraints, sizing, and positioning</strong> — these mysterious errors will start to make perfect sense.</p><p>If you’re not a Medium member, you can read full story <a href="https://medium.com/@theapp_forge/626e58c292cc?source=friends_link&amp;sk=bcaef32171267a1c3568876ca1489054">here</a>.</p><figure><img alt="Cover image" src="https://cdn-images-1.medium.com/max/1024/1*g4iQK_3Z2y1NmUEJP4PC3Q.png" /><figcaption>Image by Author</figcaption></figure><h3>Flutter’s layout algorithm</h3><p>Flutter’s layout is a <strong>one-pass process</strong>:</p><ol><li>Parent <strong>passes constraints down</strong>.</li><li>Child <strong>chooses a size</strong> that fits those constraints.</li><li>Parent <strong>positions</strong> the child based on that size.</li></ol><p>Okay — but what does this actually mean?</p><p>Let’s unpack it.</p><h4><strong>What is a constraint?</strong></h4><p>A <strong>constraint</strong> is a set of rules the parent gives to a child about how big it can be — usually defined by <strong>minimum and maximum width and height</strong>.<br>For example:</p><p>A parent might say:</p><p><em>“You can be anywhere between 0 and 200 pixels tall.” </em>Or</p><p><em>“You must be exactly 300 pixels wide.”</em></p><p>The child then chooses its own size <strong>within</strong> those constraints and reports that size back to the parent.</p><p>Then, parent sets the position.</p><h4><strong>Then, What does “unbounded” mean?</strong></h4><p>“Unbounded” simply means <strong>no upper limit</strong>.</p><p>If a widget receives <strong>unbounded height</strong>, it means its parent didn’t tell it how tall it can be — it’s free to be as tall as it wants.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NlZpeumfMa1o-I9h.png" /><figcaption>Conversation between Column parent and ListView child (AI generated)</figcaption></figure><p>That sounds flexible, but it actually causes problems for certain widgets.</p><p>Widgets, like ListView, GridView, or Expanded try to take up as much space as possible. Without a defined height from their parent, they don’t know how much space to fill, which leads to layout errors.</p><p>Other widgets, like Column, Row, or even a VerticalDivider, are <strong>content-based</strong> — they size themselves based on their children or surrounding layout. For instance, a VerticalDivider won’t render correctly inside a Row unless it’s given a fixed height, because it doesn’t know how tall it should be when the parent provides unbounded height.</p><h4>What is a Flex Widget?</h4><p>A <strong>flex widget</strong> in Flutter is any widget that <strong>extends the </strong><strong>Flex class.</strong> It arranges its children <strong>linearly</strong> — either <strong>vertically</strong> or <strong>horizontally</strong> — and can distribute available space among them <strong>proportionally or flexibly</strong>.</p><blockquote>In simple terms, A <strong>flex widget</strong> controls how its children share space along one direction (main axis).</blockquote><h4>Flex Widgets</h4><ul><li><strong>Row —</strong> lays out children <strong>horizontally</strong> (left to right).</li><li><strong>Column — </strong>lays out children <strong>vertically</strong> (top to bottom).</li><li><strong>Flex</strong> — <strong>base class</strong> for both Row and Column; lets us specify the direction manually using the direction property (Axis.horizontal or Axis.vertical).</li></ul><h4>Understanding Column behavior</h4><p>As constraints passed down from parents, column gets a bounded or unbounded height depending on the parent.</p><p>Let’s look at 2 examples.</p><ul><li>Inside a Scaffold.body, a Column gets a finite height constraint — the whole screen</li><li>Inside a SingleChildScrollView, a Column is asked to be as tall as it wants — no vertical limit</li></ul><p><strong>How does column behaves in these two scenarios?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eh1aC_eQzjFKx0CZ.png" /><figcaption>Column behavior in Flutter</figcaption></figure><p><strong>Example 1: </strong><strong>Column with Bounded Height</strong></p><pre>class ColumnExample1 extends StatelessWidget {<br>  const ColumnExample1({super.key});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    // Scaffold pass down screen height to Column<br>    return Scaffold(<br>      body: SafeArea(<br>        child: Container(<br>          color: Colors.teal,<br>          // Column gets all available screen height <br>          // after padding left for SafeArea<br>          child: Column(children: [Text(&#39;Column Data&#39;)]),<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><p>Here, the Column knows exactly how tall it can be — so everything works fine.</p><p><strong>Example 2: </strong><strong>Column with Unbounded Height</strong></p><pre>class ColumnExample2 extends StatelessWidget {<br>  const ColumnExample2({super.key});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    // Scaffold pass down screen height to SafeArea<br>    return Scaffold(<br>      body: SafeArea(<br>        // ListView has scrolling area as all available screen height passed down from SafeArea<br>        // But it doesn&#39;t pass any vertical constraint to its children      <br>        child: ListView(<br>          children: [<br>            Container(<br>              color: Colors.teal,<br>              // Column gets infinite vertical space<br>              child: Column(children: [Text(&#39;Column Data&#39;)]),<br>            ),<br>          ],<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><p>Now, the Column is told:</p><blockquote><em>“You can be as tall as you want.”</em></blockquote><p>This means it has <strong>unbounded height</strong> — which can lead to issues if its children also try to expand.</p><h4>Understanding ListView Behavior</h4><p>ListView is a <strong>scrollable</strong> that always tries to <strong>fill the available space</strong> in its scroll direction.</p><p>Let’s look at this example.</p><pre>class ListViewExample1 extends StatelessWidget {<br>  const ListViewExample1({super.key});<br>  <br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      body: Container(<br>        color: Colors.blue,<br>        // Even when there is no child it takes up all available space - greedy!<br>        child: ListView(children: []),<br>      ),<br>    );<br>  }<br>}</pre><p>Because the parent Container has a bounded height, the ListView expands to fill it.<br>If the parent didn’t provide a fixed height, this would cause an <em>“unbounded height”</em> error.</p><figure><img alt="ListView behavior in Flutter" src="https://cdn-images-1.medium.com/max/926/0*tXZJgRr02Yg45DX2.png" /><figcaption>ListView behavior in Flutter</figcaption></figure><h4>Understanding SingleChildScrollView Behavior</h4><p>A SingleChildScrollView, on the other hand, behaves differently.</p><p>It <strong>does not</strong> force its child to fill the available space — instead, it <strong>wraps its content</strong>.</p><pre>class SingleChildScrollViewExample1 extends StatelessWidget {<br>  const SingleChildScrollViewExample1({super.key});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      body: SafeArea(<br>        child: Container(<br>          color: Colors.red,<br>          // Gets only the vertical space needed for the child to lay down<br>          child: SingleChildScrollView(child: Text(&#39;Scroll View Data&#39;)),<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><figure><img alt="SingleChildScrollView behavior in Flutter" src="https://cdn-images-1.medium.com/max/1024/0*kMlElnabQdhO9CiX.png" /><figcaption>SingleChildScrollView behavior in Flutter</figcaption></figure><p>So unlike ListView, it doesn’t expand to fill the screen. It only grows as big as its child needs.</p><h4>Categorizing Widgets for Clarity</h4><p>I would like to separate these widgets into two categories considering their behavior.</p><pre>------------------------------------------------------------------------------<br>Greedy Widgets                      |      Generous Widgets<br>------------------------------------------------------------------------------<br>ListView                            |      SingleChildScrollView  <br>Column (When bounded)               |      Column (when unbounded)</pre><ul><li><strong>Greedy widgets</strong> try to take up all available space.</li><li><strong>Generous widgets</strong> adapt to their children’s size or allow them to take as much as they need.</li></ul><h4>Overflow Issue</h4><p>When column has <strong>bounded vertical space</strong> and it gets <strong>more children than it can fit </strong>in the available space, it gives an <strong>overflow</strong> error.</p><pre>class ColumnExample3 extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      body: SafeArea(<br>        child: Column(<br>          children: [<br>            Container(height: 150, color: Colors.yellow),<br>            Container(height: 150, color: Colors.teal),<br>            Container(height: 150, color: Colors.red),<br>            Container(height: 150, color: Colors.blue),<br>            Container(height: 150, color: Colors.teal),<br>            Container(height: 150, color: Colors.yellow),<br>            Container(height: 150, color: Colors.teal),<br>          ],<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><figure><img alt="Overflow error" src="https://cdn-images-1.medium.com/max/1024/0*PbZ-zHmy8XsyJ2N_.png" /><figcaption>Overflow error</figcaption></figure><p>Why does this issue occur? This happens because there’s <strong>not enough space</strong>to display all the children vertically.</p><p>If the <strong>content usually fits the screen and only <em>occasionally</em> overflows</strong>, we can wrap it in a SingleChildScrollView:</p><pre>class ColumnExample4 extends StatelessWidget {<br>  const ColumnExample4({super.key});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      body: SafeArea(<br>        child: SingleChildScrollView(<br>          child: Column(<br>            crossAxisAlignment: CrossAxisAlignment.stretch,<br>            children: [<br>              Container(<br>                color: Colors.yellow,<br>                height: 250,<br>                child: Text(&#39;Column Data&#39;),<br>              ),<br>              Container(<br>                color: Colors.teal,<br>                height: 250,<br>                child: Text(&#39;Column Data&#39;),<br>              ),<br>              Container(<br>                color: Colors.red,<br>                height: 250,<br>                child: Text(&#39;Column Data&#39;),<br>              ),<br>              Container(<br>                color: Colors.blue,<br>                height: 250,<br>                child: Text(&#39;Column Data&#39;),<br>              ),<br>              Container(<br>                color: Colors.teal,<br>                height: 250,<br>                child: Text(&#39;Column Data&#39;),<br>              ),<br>            ],<br>          ),<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><p>This approach is best for <strong>small to medium</strong> amounts of content.<br>For large or infinite lists, prefer ListView, which builds items lazily for performance.</p><p>Column and SingleScrollView are not optimized for large/infinite lists as they load all children at once.</p><h4>Non-Flex vs. Flex Children</h4><p>In a Column or Row, <strong>non-flex children</strong> are those <em>not</em> wrapped in Expanded or Flexible.<br>They take their natural size — whatever they need — without sharing space proportionally.</p><p>Flex children Expanded or Flexible are given a <strong>bounded</strong> size by the parent.</p><p>In Column, once a child is wrapped with Expanded or Flexible, it does not allow the child to take as much as height they want but rather has to adhere to the height Expanded widget allocate after considering all other children in that Column.</p><p>Example:</p><pre>Column(<br>  children: [<br>    Text(&quot;Header&quot;), // non-flex child<br>    Expanded(child: Container(color: Colors.blue)), // flex child<br>  ],<br>);</pre><figure><img alt="Expanded behavior in Flutter" src="https://cdn-images-1.medium.com/max/838/0*K3TpsH5i5XX5-oL3.png" /><figcaption>Expanded behavior in Flutter</figcaption></figure><p>Here, the Expanded widget tells the Column:</p><blockquote><em>“I’ll take the remaining available space.”</em></blockquote><p>Without it, a greedy child might try to grow indefinitely, causing unbounded errors.</p><h4>The “Scrollable Inside Column” Error</h4><p>Consider this example:</p><pre>class ColumnExample6 extends StatelessWidget {<br>  const ColumnExample6({super.key});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      body: SafeArea(<br>        child: Column(<br>          children: [<br>            Text(&#39;Outer Column data&#39;),<br>            ListView.builder(<br>              itemCount: 50,<br>              itemBuilder: (context, index) =&gt;<br>                  ListTile(title: Text(&#39;ListItem&#39;)),<br>            ),<br>          ],<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><p>This throws the <em>“Vertical viewport was given unbounded height”</em> error.</p><figure><img alt="Unbounded height error" src="https://cdn-images-1.medium.com/max/1024/0*NEQyISuUN2qG5YNh.png" /><figcaption>Unbounded height error</figcaption></figure><p>That’s because, Column is saying:</p><p><em>“I don’t know how tall you can be, take as much as you want”</em></p><p>but ListView complains:</p><p><em>“Tell me exactly how tall I can be so I know how many items to render.”</em></p><p><strong>Why </strong><strong>ListView needs a bounded height?</strong></p><p>ListView is a <strong>scrollable viewport</strong>:</p><p>It doesn’t render all children at once.</p><p>Instead, it only renders <strong>enough to fill the viewport</strong> and a little extra cache area.</p><p>To know <em>how many children to render</em>, it needs to know: <strong><em>“How tall is my viewport?”</em></strong></p><p>If the parent gives it <strong>unbounded height,</strong> the list says:</p><ul><li>“Okay… then I’ll render all items, because there’s no limit.”</li><li>This breaks the lazy-loading optimization and can cause layout errors like what we saw.</li></ul><p><strong>What is the solution?</strong></p><p>Wrap the ListView in a constraint-providing widget:</p><ul><li>Expanded; fills remaining space</li><li>Flexible; similar, but allows resizing</li><li>SizedBox or Container(height: ...); gives fixed height</li></ul><p>Solution to the example: Let’s wrap this in Expanded widget.</p><pre>// Make ListView a Flex child<br>Expanded(<br>  child: ListView.builder(<br>    itemCount: 50,<br>    itemBuilder: (context, index) =&gt; ListTile(title: Text(&#39;ListItem&#39;)),<br>  ),<br>),</pre><p>Now, the Column gives the ListView a <strong>bounded height</strong>, fixing the issue.</p><p><strong>How </strong><strong>Column Fixes It ?</strong></p><ul><li>For <strong>non-flex children</strong>, Column asks:<br>“How tall do you want to be?” which can cause unbounded height.</li><li>For <strong>flex (non-zero flex)</strong> children, Column divides remaining space and gives them a bounded height.</li></ul><h4>When Column Is Inside a Scrollable</h4><p>Now, consider this case:</p><pre>class ColumnExample8 extends StatelessWidget {<br>  const ColumnExample8({super.key});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      body: SafeArea(<br>        // Scrollable - Infinite Height<br>        child: ListView(<br>          children: [<br>            Text(&#39;Outer ListView data&#39;),<br>            Column(<br>              children: [<br>                Text(&#39;Inner Column data&#39;),<br>                //Flex (non-zero flex) child<br>                Expanded(<br>                  child: ListView.builder(<br>                    itemCount: 50,<br>                    itemBuilder: (context, index) =&gt;<br>                        ListTile(title: Text(&#39;Inner ListItem&#39;)),<br>                  ),<br>                ),<br>              ],<br>            ),<br>          ],<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><figure><img alt="Error screenshot" src="https://cdn-images-1.medium.com/max/1024/0*zdngxDQsS5D1aWLa.png" /><figcaption>Error</figcaption></figure><p>Here, the Expanded is asking for <em>all available vertical space</em> inside an <strong>infinite</strong>scrollable.<br>But in an infinite space, “all available” means <strong>infinite height</strong>, which is impossible to layout — so Flutter throws an error.</p><p>In such cases, rethink the structure.<br>Instead of nesting scrollables, use <strong>CustomScrollView</strong> or <strong>Slivers</strong> to combine multiple scrollable sections efficiently.</p><h4>When nesting ListView inside another scrollable</h4><p>In this example, we have a ‘<em>greedy</em>’ ListView inside a SingleChildScrollView where there is no vertical constraint.</p><pre>SingleChildScrollView(<br>  child: Column(<br>    children: [<br>      Text(&#39;Header&#39;),<br>      ListView.builder(<br>        itemCount: items.length,<br>        itemBuilder: (context, index) =&gt; ListTile(title: Text(items[index])),<br>      ),<br>    ],<br>  ),<br>);</pre><p>Two scrollables will conflict. In this case:</p><ul><li>Use shrinkWrap: true</li><li>Disable one’s scrolling with physics: NeverScrollableScrollPhysics</li></ul><pre>SingleChildScrollView(<br>  child: Column(<br>    children: [<br>      Text(&#39;Header&#39;),<br>      ListView.builder(<br>        shrinkWrap: true,<br>        physics: NeverScrollableScrollPhysics(),<br>        itemCount: items.length,<br>        itemBuilder: (context, index) =&gt; ListTile(title: Text(items[index])),<br>      ),<br>    ],<br>  ),<br>);</pre><p>This makes the outer scroll view handle scrolling, and the list just lays itself out.</p><p><strong>Why </strong><strong>shrinkWrap: true fixes it?</strong></p><pre>ListView.builder(<br>  shrinkWrap: true,<br>  physics: NeverScrollableScrollPhysics(),<br>  itemCount: items.length,<br>  itemBuilder: (context, index) =&gt; ListTile(title: Text(items[index])),<br>),</pre><p><strong>shrinkWrap: true</strong> tells the ListView to <strong>measure itself based on its children’s total height</strong>, instead of trying to fill infinite space.</p><blockquote><em>What to consider:</em></blockquote><blockquote><em>For long lists with hundreds of items, </em><em>shrinkWrap: true forces Flutter to </em><strong><em>build all items at once</em></strong><em>, which kills performance.</em></blockquote><h3>Summary</h3><ul><li><strong>Unbounded height</strong> means the parent didn’t provide an upper limit.</li><li><strong>Scrollables</strong> (ListView, GridView, etc.) need <strong>bounded constraints</strong>.</li><li>Use Expanded or Flexible to turn children into <strong>flex widgets</strong> inside Columnor Row.</li><li>Use SingleChildScrollView for short, scrollable layouts.</li><li>Use ListView for long or infinite lists.</li><li>Avoid <strong>nesting multiple scrollables</strong> unless using CustomScrollView and Slivers.</li></ul><p>Once you understand these principles, you’ll stop <em>guessing</em> layouts and start mastering Flutter’s constraint system.</p><h3>💬 Let’s chat!</h3><p>Got any questions ? Drop them in the comments!</p><p>🖱️ <strong>Follow me on Medium</strong> to get more tech content like this.</p><p>👏 If you found this helpful, hit that clap button — it keeps me motivated to write more in-depth guides!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=626e58c292cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Choose Right Typography For Your Application]]></title>
            <link>https://medium.com/@champs_hamy/how-to-choose-right-typography-for-your-application-c5bac5f68a30?source=rss-1170b5949840------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5bac5f68a30</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ux-design]]></category>
            <dc:creator><![CDATA[Champani Hamy]]></dc:creator>
            <pubDate>Tue, 21 Oct 2025 14:14:00 GMT</pubDate>
            <atom:updated>2025-10-22T01:46:24.167Z</atom:updated>
            <content:encoded><![CDATA[<h4>Typography isn’t just decoration and here’s why</h4><p>First check this out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nDGeAtKZEQ4C3I-2M-PA5Q.png" /><figcaption>Image by Author (AI)</figcaption></figure><p>Imagine these were the actual typographies used in Stripe website.</p><p><strong><em>If so, would you ever use Stripe for your transactions again?</em></strong></p><p>This design alone shows why typography is crucial — it’s not merely decorative; it speaks for your application before anything else gets the chance to.</p><p>In the example image, the chosen typography fails to convey the credibility that matches Stripe’s business values. <strong>So how do we pick the right font for our apps, and what factors should we consider?</strong> Let’s dig in.</p><p>If you’re not a Medium member, read full story <a href="https://medium.com/@theapp_forge/how-to-choose-right-typography-for-your-application-c5bac5f68a30?sk=9947b58e7f54ac6c78a0ef8a026ef131">here</a>.</p><p>Stripe’s confident and clean typeface conveys trust, professionalism, and modern sophistication.</p><p>Nike’s bold, angular letters scream energy and movement.</p><p>Notion’s modern serif feels intelligent and human.</p><p>Oatly’s quirky, hand-drawn type rebels against tradition.</p><p>These aren’t accidents — they’re <strong>strategic decisions backed by psychology.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SAv_Z3D8XvKY6ELz" /><figcaption>Photo by <a href="https://unsplash.com/@brett_jordan?utm_source=medium&amp;utm_medium=referral">Brett Jordan</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Font psychology reveals that typefaces carry psychological weight, influencing emotions and behavior.</p><p>A heavy, bold font conveys confidence and authority, encouraging users to take action.</p><p>A light, airy font whispers elegance and subtlety.</p><p>The wrong font? It’s like showing up to a board meeting in a clown costume — memorable, but for all the wrong reasons.</p><p>Research shows that fonts can make or break brand perception. They act as your brand’s visual voice, resonating with your target audience and evoking specific emotions you want associated with your business. Get it wrong, and potential customers turn away before engaging with your message.</p><h3>Understanding font categories</h3><h4>Serif fonts</h4><p>With origins in 18th-century printing, <strong>serif fonts</strong> are perceived as elegant, trustworthy, and established. Those small decorative strokes at the ends of letters aren’t just ornamental — they <strong>convey tradition, reliability, and stability.</strong></p><p><strong>Perfect use-cases:</strong> Law firms, insurance companies, financial institutions, luxury brands, and any business wanting to inspire trust and respect.</p><p><strong>Examples in action:</strong></p><ul><li><strong>Times New Roman</strong> — The classic choice for formal documents</li><li><strong>Georgia</strong> — Designed for digital readability with timeless elegance</li><li><strong>Garamond</strong> — Refined and sophisticated, favored by high-end publishers</li><li><strong>Playfair Display</strong> — Modern serif with high contrast for editorial elegance</li><li><strong>Merriweather</strong> — Contemporary serif optimized for screens</li></ul><p>Notice how established newspapers and legal firms consistently choose serifs. They’re signaling</p><blockquote><strong>“we’ve been here, we’ll be here, you can count on us.”</strong></blockquote><h4>Sans-Serif fonts:</h4><p>Clean, crisp, and refreshingly simple. <strong>Sans-serif fonts</strong> embody a straightforward, no-nonsense attitude while feeling progressive and open. Without the decorative strokes, they’re seen as <strong>modern, friendly, and approachable </strong>— perfect for the digital age.</p><p><strong>Perfect use-cases:</strong> Tech startups, modern brands, apps, websites, and any business wanting to feel contemporary and accessible.</p><p><strong>Examples in action:</strong></p><ul><li><strong>Helvetica</strong> — The Swiss Army knife of fonts, clean and universally legible</li><li><strong>Roboto</strong> — Google’s Android standard, geometric yet friendly</li><li><strong>SF Pro (San Francisco)</strong> — Apple’s choice for iOS, optimized for every screen size</li><li><strong>Inter</strong> — Designed specifically for digital interfaces</li><li><strong>Montserrat</strong> — Geometric elegance inspired by Buenos Aires signage</li></ul><p>Spotify, Airbnb, Google — notice a pattern? Modern, user-first companies choose sans-serif to feel approachable and forward-thinking.</p><h4>Script fonts</h4><p>Inspired by handwriting and calligraphy, script fonts are rich in emotion and history. They inspire creative ideas and add personality, but like hot sauce, a little goes a long way. Overuse makes text unreadable; strategic use makes it unforgettable.</p><p><strong>Perfect use-cases:</strong> Wedding brands, luxury goods, creative agencies, cosmetics, and anywhere you need a personal, elegant, or artistic touch. <em>Never for body text.</em></p><p><strong>Examples in action:</strong></p><ul><li><strong>Pacifico</strong> — Casual, beachy, and fun for lifestyle brands</li><li><strong>Great Vibes</strong> — Elegant calligraphy for high-end occasions</li><li><strong>Dancing Script</strong> — Lively and friendly, perfect for invitations</li><li><strong>Allura</strong> — Flowing elegance for beauty and fashion</li><li><strong>Pinyon Script</strong> — Vintage sophistication</li></ul><p>Coca-Cola’s Spencerian script has remained virtually unchanged since 1886, proving that the right script becomes timeless brand equity.</p><h4>Display/Decorative fonts</h4><p>Highly stylized and impossible to ignore, <strong>display fonts </strong>are designed for one purpose: maximum visual impact. They’re <strong>fresh, innovative</strong>, and often contain pictorial elements. Use them for flashy headlines and moments when you need to scream, not whisper.</p><p><strong>Perfect use - cases:</strong> Entertainment, food &amp; beverage, children’s brands, fashion, and any industry emphasizing personality over convention. <em>Headlines only — never body text.</em></p><p><strong>Examples in action:</strong></p><ul><li><strong>Bebas Neue</strong> — Tall, condensed, commanding attention</li><li><strong>Lobster</strong> — Quirky and playful with retro charm</li><li><strong>Righteous</strong> — Strong geometric shapes for bold statements</li><li><strong>Bungee</strong> — Chromatic display font with urban energy</li><li><strong>Fredoka One</strong> — Rounded, friendly, perfect for kid-focused brands</li></ul><p>Disney’s custom display font instantly transports you to childhood wonder. That’s the power of the right display type.</p><h3>Summary</h3><p>Your font choice communicates your company’s values, personality, and message before anyone reads a word. The right typography resonates with your target audience and builds recognition. The wrong one? It turns off potential customers and kills credibility.</p><p>Research confirms that 70% of users prefer text sizes and styles that facilitate comfortable reading, and 80% find sans-serif fonts more legible on digital platforms. But readability alone isn’t enough — your font must match your brand’s soul.</p><p>So before you choose that trendy font or stick with the default, ask yourself:</p><p><em>Does this reflect who we are?</em></p><p><em>Does it speak to our audience?</em></p><p><em>Will it work everywhere, from mobile screens to billboards?</em></p><p>Because typography isn’t about decoration — it’s strategy. It’s psychology. It’s the difference between being heard and being ignored.</p><p>Choose wisely. Your brand depends on it.</p><h4>💬 Let’s chat!</h4><p>Got any questions ? Drop them in the comments!</p><p>🖱️ <strong>Follow me on Medium</strong> to get more tech content like this.</p><p>👏 If you found this helpful, hit that clap button — it keeps me motivated to write more in-depth guides!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5bac5f68a30" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Realtime Data Fetching Isn’t Always Right.]]></title>
            <link>https://medium.com/@champs_hamy/realtime-isnt-always-right-how-to-decide-if-your-app-truly-needs-instant-data-6be276c45e23?source=rss-1170b5949840------2</link>
            <guid isPermaLink="false">https://medium.com/p/6be276c45e23</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[computer-science]]></category>
            <dc:creator><![CDATA[Champani Hamy]]></dc:creator>
            <pubDate>Sun, 19 Oct 2025 09:14:24 GMT</pubDate>
            <atom:updated>2025-11-06T06:09:07.222Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to Decide If Your App Truly Needs Instant Data</h4><p>I started building an app with Supabase recently and came across multiple tutorials showing how to build various apps with realtime features. I tested both approaches myself — normal database fetches and realtime subscriptions.</p><p>Here’s what I noticed: the ease of implementing realtime and seeing changes update in a second makes it incredibly tempting to use everywhere. Realtime has become the holy grail of modern app development.</p><p>But a question kept coming up in my head: <strong>When should I actually use realtime data fetching, and when should I avoid it?</strong></p><p>That’s what this article is all about. I hope by the end, it helps you make the right decision for the app you’re building.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MAYWBHx9q9vrEW9E" /><figcaption>Photo by <a href="https://unsplash.com/@kanchanara?utm_source=medium&amp;utm_medium=referral">Kanchanara</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If you’re not a member, read full article <a href="https://medium.com/@theapp_forge/realtime-isnt-always-right-how-to-decide-if-your-app-truly-needs-instant-data-6be276c45e23?sk=3733153668fa01db166700dc03901807">here</a>.</p><h3>What realtime data fetching actually means ?</h3><p>Before we dive into the <em>when</em>, let’s clarify the <em>what</em>.</p><p>Realtime data fetching means your <strong>client gets notified of server changes immediately or near-instantly without manually refreshing or polling</strong>. This typically involves:</p><ul><li><strong>Push technologies</strong> like WebSockets, Server-Sent Events (SSE), or realtime database subscriptions</li><li><strong>Persistent connections</strong> that stay open between client and server</li><li><strong>Immediate propagation</strong> of changes from server to client</li></ul><p>This contrasts sharply with traditional request-response patterns where your client sends an HTTP GET request, receives a response and later requests fresh data when needed.</p><p>While <strong>realtime doesn’t always mean full bidirectional communication</strong>, it typically implies higher costs, greater complexity, and significant architectural trade-offs.</p><h3>When realtime data fetching is actually necessary ?</h3><p>Here’s when realtime data fetching is not just justified — it’s essential.</p><h4>1. Collaborative or shared live state</h4><p><strong>The scenario:</strong> Multiple users interact simultaneously, and each person’s actions must be visible to others immediately.</p><p><strong>Examples:</strong></p><ul><li>Chat applications</li><li>Multiplayer games</li><li>Live whiteboards</li><li>Collaborative document editing (think Google Docs)</li></ul><p><strong>Why it matters:</strong> Without near-instant propagation, the user experience degrades rapidly. Imagine editing a document where you can’t see your colleague’s changes for 30 seconds. Chaos ensues.</p><h4>2. Live dashboards, monitoring, and tracking</h4><p><strong>The scenario:</strong> Data changes frequently, and users expect live updates rather than stale snapshots.</p><p><strong>Examples:</strong></p><ul><li>Stock tickers</li><li>Live sports scores</li><li>Vehicle tracking systems</li><li>IoT sensor dashboards</li></ul><p><strong>Why it matters:</strong> Latency directly impacts value. A stock price from five minutes ago isn’t just outdated — it’s potentially misleading or worthless.</p><h4><strong>3. Event-driven UI where delay degrades UX</strong></h4><p><strong>The scenario:</strong> Even small delays create significant problems for users.</p><p><strong>Examples:</strong></p><ul><li>Trading applications where seconds matter</li><li>Collaborative editing where conflicts arise from delayed updates</li><li>Presence indicators and typing notifications in messaging apps</li><li>Live auction platforms</li></ul><p><strong>Why it matters:</strong> Your business logic depends on immediacy. Delays don’t just annoy users — they break core functionality.</p><h4>4. Push updates for active sessions</h4><p><strong>The scenario:</strong> The client is actively engaged, and you want instant updates instead of periodic polling.</p><p><strong>Examples:</strong></p><ul><li>Live quiz or game sessions where participants see other’s answers in real time</li><li>Live event broadcasts with audience interaction</li><li>Real-time voting or polling interfaces</li></ul><h3><strong>The bottom line:</strong></h3><p><strong><em>If latency matters, the state changes frequently, and users expect up-to-the-second freshness, you need realtime.</em></strong></p><h3>When realtime becomes expensive overkill</h3><p>Now for the harder conversation: when realtime hurts more than it helps?</p><h4>1. Infrequent data changes or read-only content</h4><p><strong>The reality:</strong> If data only changes when the user triggers it or changes rarely from external sources, realtime adds zero value.</p><p><strong>Examples:</strong></p><ul><li>User settings and account profiles</li><li>Static content, articles, or product catalogs</li><li>Configuration data</li></ul><h4>2. Users don’t expect immediate updates</h4><p>A personal to-do list app where you edit your own items. Does it matter if someone else’s view is delayed by 30 seconds? Probably not.</p><p><strong>What to do instead:</strong> Fetch on demand, cache aggressively, and refresh periodically.</p><h4>3. High cost vs. marginal benefit</h4><p>Persistent connections consume more resources — battery, memory, and network bandwidth.</p><p><strong>The problem:</strong></p><ul><li>Scaling becomes significantly harder</li><li>Backend infrastructure costs multiply with concurrent connections</li><li>Development complexity increases dramatically</li></ul><h4>4. Offline or intermittent connectivity</h4><p><strong>The reality:</strong> If users frequently lose connectivity or your app runs in the background, realtime becomes fragile and unreliable.</p><p><strong>What to do instead:</strong> A simpler fetch + cache + sync-on-reconnect pattern is more robust and predictable.</p><h4>5. Cost and scale optimization priorities</h4><p><strong>The reality:</strong> For large-scale systems, thousands or millions of concurrent connections can be prohibitively expensive.</p><p><strong>What to do instead:</strong> If the user value doesn’t justify infrastructure costs, choose simpler patterns.</p><h3>Best practices when you choose realtime</h3><p>When you decide realtime is necessary, here’s how to implement it wisely:</p><h4>Choose the right protocol</h4><ul><li><strong>Server </strong>↔ <strong>client Full bidirectional messaging</strong> : Use WebSockets or libraries like Socket.io</li><li><strong>Server → client updates only</strong>: Consider Server-Sent Events (SSE) for simpler unidirectional push</li><li><strong>Realtime databases</strong>: Firebase Realtime Database or Supabase Realtime use WebSockets under the hood — understand their scaling limits</li></ul><h4>Monitor impact</h4><ul><li>Track battery drain on mobile devices</li><li>Test behavior in background modes</li><li>Plan for connectivity drops</li></ul><h4>Build in graceful degradation</h4><ul><li>If the connection is lost, fall back to polling</li><li>Don’t make realtime a single point of failure</li></ul><h4>Consider costs and scale</h4><ul><li>Persistent connections tie up server resources</li><li>Test concurrent connection limits early</li><li>Budget for infrastructure costs at scale</li></ul><h4>Keep architecture clean</h4><ul><li>Separate <strong>hot</strong> realtime updates from <strong>warm/cold</strong> data fetches</li><li>Don’t make everything realtime just because you can</li><li>Maintain a coherent offline/sync strategy — realtime doesn’t eliminate caching needs</li></ul><h3>Best practices when you skip realtime</h3><p>If realtime isn’t necessary, here’s how to build efficiently:</p><h4>Use standard patterns</h4><ul><li>REST or GraphQL API fetches</li><li>Batch requests when possible</li><li>Short-lived connections</li></ul><h4>Cache aggressively</h4><ul><li>Local storage or device database</li><li>Sync on app foreground or open</li><li>Implement smart cache invalidation</li></ul><h4>Provide manual refresh options</h4><ul><li>Pull-to-refresh functionality</li><li>Background refresh at reasonable intervals</li><li>“Last updated X minutes ago” timestamps</li></ul><h4>Combine with light push notifications</h4><ul><li>Wake the app when something important changes</li><li>Then fetch on demand rather than maintaining persistent connections</li></ul><h4>Design for staleness</h4><ul><li>Set user expectations through UI</li><li>Make stale data acceptable and visible</li><li>Keep complexity low and scaling simple</li></ul><h3>Final thoughts</h3><p>Realtime data fetching is powerful — but it’s not the default best choice. Use it when your app genuinely needs live updates, involves multiple actors, requires low latency, and the complexity is justified.</p><p>For everything else, choose simpler patterns:</p><p><em>Fetch when needed</em></p><p><em>Cache smartly</em></p><p><em>Degrade gracefully</em></p><p>As developers, we can save ourselves enormous headaches — both on the device and server, by making this decision consciously <strong><em>before</em></strong> wiring up WebSocket subscriptions or realtime database listeners.</p><p><strong>The real skill isn’t knowing how to build realtime systems — it’s knowing when not to.</strong></p><h3>💬 Let’s Chat!</h3><p>Got any questions ? Drop them in the comments!</p><p>🖱️ <strong>Follow me on Medium</strong> to get more tech content like this.</p><p>👏 If you found this helpful, hit that clap button — it keeps me motivated to write more in-depth guides!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6be276c45e23" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tech Interview ? Learn The Difference Between Architectural Patterns and Design Patterns]]></title>
            <link>https://medium.com/@champs_hamy/tech-interview-learn-the-difference-between-architectural-patterns-and-design-patterns-26753e855dc6?source=rss-1170b5949840------2</link>
            <guid isPermaLink="false">https://medium.com/p/26753e855dc6</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Champani Hamy]]></dc:creator>
            <pubDate>Sun, 28 Sep 2025 04:47:49 GMT</pubDate>
            <atom:updated>2025-11-13T08:25:19.884Z</atom:updated>
            <content:encoded><![CDATA[<h3>Tech Interview ? Learn The Difference Between Architectural Patterns and Design Patterns</h3><h4>Let me help you with upcoming tech interview.</h4><p>Most famous question in any tech interview is the difference between design patterns and software architectural patterns.</p><p>Let me help you to understand it for once and for all.</p><p>If you’re not a Medium Member, you can read full article <a href="https://medium.com/@theapp_forge/tech-interview-learn-the-difference-between-architectural-patterns-and-design-patterns-26753e855dc6?sk=dab1433fab6523645d90a37ee276b76f">here</a>.</p><h3>A Software Architectural pattern</h3><p>is a <strong>high level solution</strong> to solve a complex architectural problem that makes a software harder to work with.</p><p>This includes at least a significant part of the application if not full application.</p><p>It gives a guideline to follow using the collective experiences of engineers solving these issues by trying and testing different solutions for years.</p><p><strong>Example:</strong></p><p>When an architect designs a house, they must follow specific guidelines to get the plan approved. These guidelines ensure the structure avoids major issues such as;</p><p>how to build proper water drainage to prevent flooding,</p><p>or where to place windows to allow natural sunlight in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6-pPByPbs0_3Z9ad" /><figcaption>Photo by <a href="https://unsplash.com/@ryanancill?utm_source=medium&amp;utm_medium=referral">Ryan Ancill</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Now let’s see what it is a design pattern.</p><h3><strong>A Design pattern</strong></h3><p>is <strong>a low level (class level) solution</strong> that provides most <strong>effective implementation of common classes</strong> of the application to <strong>improve interactivity and reusability </strong>of the classes.</p><p>This is a tiny part of the application.</p><p>Some examples are,</p><ol><li>Adapter Pattern</li><li>Factory pattern</li><li>Singleton</li><li>Decorator pattern</li></ol><p>If you want to dive deeper into these concepts, here are some great resources to get started.</p><ul><li><a href="https://www.google.lk/books/edition/Head_First_Design_Patterns/GGpXN9SMELMC?hl=en&amp;gbpv=0">Head First Design Patterns</a></li><li><a href="https://www.google.lk/books/edition/Design_Patterns/6oHuKQe3TjQC?hl=en">Design Patterns</a></li></ul><p>If you’re preparing for interviews,</p><p><strong>Remember this:</strong></p><p>It’s not just about memorizing patterns or frameworks — it’s about showing how you think, solve problems, and keep learning.</p><p>Every interview is a chance to grow, not just to get hired.</p><p>So walk in with confidence, trust the effort you’ve put in, and let your curiosity shine through.</p><p><strong><em>Wishing you clarity, courage, and success in every step of your journey.. You’ve got this.</em></strong></p><h3>💬 Let’s Chat!</h3><p>Got questions on tech interviews? Drop them in the comments!</p><p>🖱️ <strong>Follow me on Medium</strong> to get more tech content like this.</p><p>👏 If you found this helpful, hit that clap button — it keeps me motivated to write more in-depth guides!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26753e855dc6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Which Architecture Is Better For Flutter Apps: MVVM OR Clean Architecture]]></title>
            <link>https://medium.com/@champs_hamy/which-architecture-is-better-for-flutter-apps-mvvm-or-clean-architecture-acc763ea2f1f?source=rss-1170b5949840------2</link>
            <guid isPermaLink="false">https://medium.com/p/acc763ea2f1f</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Champani Hamy]]></dc:creator>
            <pubDate>Fri, 26 Sep 2025 08:58:23 GMT</pubDate>
            <atom:updated>2025-09-26T08:59:16.488Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>A comprehensive guide to choosing the right architectural pattern for your Flutter applications</em></h4><p>Choosing the right architecture is crucial for building maintainable, scalable Flutter applications.</p><p>Two popular approaches — MVVM (Model-View-ViewModel) and Clean Architecture — each serve different purposes and project scales. This guide will help you understand when and why to use each pattern.</p><blockquote>If you’re not Medium member, read full article <a href="https://medium.com/@theapp_forge/which-architecture-is-better-for-flutter-apps-mvvm-or-clean-architecture-acc763ea2f1f?sk=88fb7eb20c7ac23ccf038620f0c6f310">here</a>.</blockquote><h3>Core architectural principles</h3><h4>Separation of Concerns</h4><p>Both MVVM and Clean Architecture share a fundamental principle: <strong><em>separation of concerns</em></strong>.</p><p>This means different components in an application should be loosely coupled, allowing you to modify one part without affecting others.</p><p><strong>Key Components of a Flutter App</strong></p><p>Every Flutter application consists of these essential layers:</p><ul><li><strong>The View</strong> — What the user sees and interacts with.</li><li><strong>The Data Layer</strong> — Handles data from APIs, databases, or platform plugins.</li></ul><h4>Single Source of Truth (SSOT)</h4><p>Each data type in your application should have exactly one authoritative source. This source is responsible for:</p><ul><li>Maintaining data consistency</li><li>Handling data modifications</li><li>Providing data to other parts of the application</li></ul><h3>The problem with tightly coupled architecture</h3><p>Consider this common anti-pattern in Flutter development:</p><pre>// BAD: Tightly coupled approach<br>class UserProfileWidget extends StatefulWidget {<br>  @override<br>  _UserProfileWidgetState createState() =&gt; _UserProfileWidgetState();<br>}<br><br>class _UserProfileWidgetState extends State&lt;UserProfileWidget&gt; {<br>  User? user;<br>  bool isLoading = false;<br>  @override<br>  void initState() {<br>    super.initState();<br>    fetchUserData();<br>  }<br>  // UI directly calling API - tightly coupled!<br>  Future&lt;void&gt; fetchUserData() async {<br>    setState(() =&gt; isLoading = true);<br>    <br>    try {<br>      final response = await http.get(<br>        Uri.parse(&#39;https://api.example.com/user/profile&#39;),<br>        headers: {&#39;Authorization&#39;: &#39;Bearer $token&#39;},<br>      );<br>      <br>      if (response.statusCode == 200) {<br>        setState(() {<br>          user = User.fromJson(jsonDecode(response.body));<br>          isLoading = false;<br>        });<br>      }<br>    } catch (e) {<br>      setState(() =&gt; isLoading = false);<br>      // Handle error<br>    }<br>  }<br>  @override<br>  Widget build(BuildContext context) {<br>    if (isLoading) return CircularProgressIndicator();<br>    if (user == null) return Text(&#39;Failed to load user&#39;);<br>    <br>    return Column(<br>      children: [<br>        Text(user!.name),<br>        Text(user!.email),<br>        // More UI components...<br>      ],<br>    );<br>  }<br>}</pre><p><strong>Problems with this approach:</strong></p><ul><li>UI logic mixed with business logic</li><li>Hard to test individual components</li><li>API changes directly impact UI</li><li>Difficult to reuse logic across different screens</li><li>No clear data flow</li></ul><h3>The solution: Simple layered architecture</h3><p>To address these issues, we introduce an intermediary layer between the View and Data layers:</p><figure><img alt="Separation of each component of a flutter app" src="https://cdn-images-1.medium.com/max/779/1*mucTvmoRnW77IP7MvybXoA.png" /><figcaption>Diagram by Author</figcaption></figure><pre>View Layer ↔ View Handler ↔ Data Layer</pre><p>This creates proper dependency flow:</p><ul><li><strong>View</strong> depends only on <strong>View Handler</strong></li><li><strong>View Handler </strong>depends only on <strong>Data Layer</strong></li><li><strong>Data Layer</strong> is independent of all other layers</li></ul><h3>When to use each architecture</h3><h4>Start Simple: Basic Separation</h4><p>For MVPs and simple applications, basic layer separation is often sufficient. Here’s the most important takeaway:</p><blockquote><strong>It doesn’t matter how you structure your folders or how you name your classes.</strong>What matters most at the initial stage is understanding and implementing the dependency flow correctly.</blockquote><h4>Scale to MVVM</h4><p>Choose MVVM when:</p><ul><li>Your app is primarily UI-focused</li><li>You have moderate complexity in business logic</li><li>You need better testability than basic separation</li></ul><h4>Scale to Clean Architecture: Complex Systems</h4><p>Choose Clean Architecture when:</p><ul><li>You have complex business rules</li><li>Multiple data sources and external integrations</li><li>Need to support multiple platforms (mobile, web, desktop)</li><li>Long-term maintainability is critical</li><li>Large development teams</li></ul><h3>MVVM Architecture in Flutter</h3><p>MVVM is a <strong>UI architectural pattern</strong> that focuses specifically on the presentation layer where users interact with your application.</p><h4>MVVM Components</h4><ol><li><strong>Model</strong>: Data structures and business entities</li><li><strong>View</strong>: UI components (Widgets in Flutter)</li><li><strong>ViewModel</strong>: Presentation logic and state management</li></ol><h4>MVVM Implementation Example</h4><pre>// Model<br>class User {<br>  final String id;<br>  final String name;<br>  final String email;<br>  <br>  User({required this.id, required this.name, required this.email});<br>  <br>  factory User.fromJson(Map&lt;String, dynamic&gt; json) {<br>    return User(<br>      id: json[&#39;id&#39;],<br>      name: json[&#39;name&#39;],<br>      email: json[&#39;email&#39;],<br>    );<br>  }<br>}<br><br>// Repository (Data Layer)<br>class UserRepository {<br>  final ApiService _apiService;<br>  UserRepository(this._apiService);<br>  <br>  Future&lt;User&gt; getUserProfile() async {<br>    final response = await _apiService.get(&#39;/user/profile&#39;);<br>    return User.fromJson(response.data);<br>  }<br>}<br>// ViewModel<br>class UserProfileViewModel extends ChangeNotifier {<br>  final UserRepository _repository;<br>  <br>  User? _user;<br>  bool _isLoading = false;<br>  String? _error;<br>  <br>  User? get user =&gt; _user;<br>  bool get isLoading =&gt; _isLoading;<br>  String? get error =&gt; _error;<br>  <br>  UserProfileViewModel(this._repository);<br>  <br>  Future&lt;void&gt; loadUserProfile() async {<br>    _isLoading = true;<br>    _error = null;<br>    notifyListeners();<br>    <br>    try {<br>      _user = await _repository.getUserProfile();<br>    } catch (e) {<br>      _error = e.toString();<br>    } finally {<br>      _isLoading = false;<br>      notifyListeners();<br>    }<br>  }<br>}<br>// View<br>class UserProfileScreen extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      appBar: AppBar(title: Text(&#39;Profile&#39;)),<br>      body: Consumer&lt;UserProfileViewModel&gt;(<br>        builder: (context, viewModel, child) {<br>          if (viewModel.isLoading) {<br>            return Center(child: CircularProgressIndicator());<br>          }<br>          <br>          if (viewModel.error != null) {<br>            return Center(child: Text(&#39;Error: ${viewModel.error}&#39;));<br>          }<br>          <br>          final user = viewModel.user;<br>          if (user == null) return Center(child: Text(&#39;No user data&#39;));<br>          <br>          return Padding(<br>            padding: EdgeInsets.all(16),<br>            child: Column(<br>              crossAxisAlignment: CrossAxisAlignment.start,<br>              children: [<br>                Text(user.name, style: Theme.of(context).textTheme.headlineMedium),<br>                SizedBox(height: 8),<br>                Text(user.email, style: Theme.of(context).textTheme.bodyLarge),<br>              ],<br>            ),<br>          );<br>        },<br>      ),<br>    );<br>  }<br>}</pre><h4>MVVM Benefits</h4><ul><li>Clear separation between UI and presentation logic</li><li>Excellent testability</li><li>Reactive updates through state management</li><li>Reusable ViewModels across different Views</li></ul><h3>Clean Architecture in Flutter</h3><p>Clean Architecture is a <strong>system-wide architectural pattern</strong> that treats your entire application as a unified system, regardless of whether it includes frontend, backend, or external integrations.</p><h4>Clean Architecture Layers</h4><ol><li><strong>Presentation Layer</strong> (UI + ViewModels/Controllers)</li><li><strong>Domain Layer</strong> (Business logic, use cases, entities)</li><li><strong>Data Layer</strong> (Repositories, data sources, external APIs)</li></ol><h4>Clean Architecture Benefits</h4><ul><li>Complete separation of business logic from external concerns</li><li>Highly testable at every layer</li><li>Framework independence</li><li>Easy to modify data sources without affecting business logic</li><li>Scalable for complex applications</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N1HjUyX-vp7F6dV3g1HgwQ.png" /><figcaption>Decision Matrix by Author</figcaption></figure><h3>Conclusion</h3><p>The choice between MVVM and Clean Architecture depends on your specific project requirements:</p><ul><li><strong>Start with basic separation</strong> for MVPs and simple apps</li><li><strong>Use MVVM</strong> when you need better UI organization and moderate scalability</li><li><strong>Adopt Clean Architecture</strong> for complex applications with long-term maintenance needs</li></ul><p><strong>Remember:</strong> you can start simple and evolve your architecture as your application grows. The key is maintaining clear separation of concerns from the beginning, making future architectural changes easier to implement.</p><p>I would love to hear your thoughts as well in the comments. Make sure to share your experience handling and architecting Flutter apps and what you learned along the way.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=acc763ea2f1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Do You Really Need Clean Architecture for Your MVP?]]></title>
            <link>https://blog.stackademic.com/do-you-really-need-clean-architecture-for-your-mvp-4520d577a949?source=rss-1170b5949840------2</link>
            <guid isPermaLink="false">https://medium.com/p/4520d577a949</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Champani Hamy]]></dc:creator>
            <pubDate>Thu, 25 Sep 2025 17:30:01 GMT</pubDate>
            <atom:updated>2025-09-25T17:54:58.656Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Here’s how you can avoid technical debt from wrong architecture decisions</strong></h4><p>Few years ago, I watched a senior developer spend three weeks implementing a clean architecture, dependency injection for what was essentially a mobile application with just 2 features.</p><p>The irony? The entire project was scrapped two months later when the business pivoted. That moment crystallized something I’d been observing throughout my career: we’re solving the wrong problems at the wrong time.</p><p>Over the past years in software development, I’ve seen brilliant engineers get trapped in architectural overthinking, while others dismiss architecture entirely until their codebase becomes unmaintainable. Both approaches fail, but for different reasons. The real issue isn’t that we don’t know good architectural patterns. it’s that we don’t know when and why to apply them.</p><p>If you’re not a Medium member, read full article <a href="https://blog.stackademic.com/do-you-really-need-clean-architecture-for-your-mvp-4520d577a949?source=friends_link&amp;sk=3a04c4e5d455b9661735f24846456cb9">here</a>.</p><figure><img alt="Overflowing cup" src="https://cdn-images-1.medium.com/max/1024/1*pq42gVesO-fAqxkTpAlung.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@zackeithharris">Zac Harris</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>The Architecture Paradox</h3><p>Here’s what I’ve learned; most architectural failures happen because we either over-engineer from day one or completely ignore structure until it’s too late.</p><p>The problem stems from a fundamental misunderstanding. Architecture isn’t about following the latest pattern you read about on Medium. It’s not about impressing your peers with sophisticated abstractions.</p><p>Architecture is about <strong>separation of concerns</strong> — organizing your code so that each piece has a single, well-defined responsibility.</p><p>This principle drives everything else: modularity, scalability, maintainability. Even your MVP needs thoughtful architecture. Not enterprise-grade complexity, but intentional structure.</p><p>Think of it this way: would you start building a house without blueprints just because you only need one room initially?</p><p>Probably not.</p><p>Sure, you could throw up some walls and it might work temporarily, but the cost of replanning and rebuilding later is enormous. The time investment multiplies exponentially with each structural change you need to make.</p><blockquote>Martin Fowler puts it perfectly: poor architecture is a major contributor to the growth of cruft.</blockquote><p>When your system lacks proper design, every feature becomes harder to implement, takes longer to build, and ships with more defects. I’ve lived this reality — debugging systems where adding a simple field required touching fifteen different files across four different layers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/0*MAykdMoYbaegfKlF.png" /><figcaption>Image from<a href="https://martinfowler.com/architecture"> martinfowler.com</a></figcaption></figure><h3>The Clean Architecture Trap</h3><p>But here’s where many developers go wrong: they assume Clean Architecture is the solution to every problem. I’ve seen teams spend months implementing hexagonal architecture for applications that would have been perfectly served by a simple MVC structure.</p><p>Choosing the wrong architectural pattern is like using a sledgehammer to hang a picture frame.</p><p>You’re not solving problems; you’re creating them. Your team spends time fighting the architecture instead of building features. Your simple requirements get buried under layers of abstraction that serve no purpose.</p><p>This is why architectural design demands <strong>systems thinking</strong>, not just pattern following. You need to understand your specific context and constraints before reaching for any solution.</p><h3>Three Critical Questions for Architectural Decisions</h3><p>After years of both successes and costly mistakes, I’ve distilled architectural thinking down to three essential questions:</p><h4>1. What’s Your System Boundary?</h4><p>Before you write a single line of code, define what you’re actually building. Are you architecting an entire ecosystem as end users see it?</p><p>Or just the frontend they interact with?</p><p>Maybe it’s a single microservice in a larger system?</p><p>I once joined a project where the team was debating between microservices and modular monolith architecture. After a week of meetings, I realized no one had clearly defined whether we were building the entire platform or just the user management component. The architecture discussion was meaningless without understanding scope.</p><h4>2. What Are Your Critical Components?</h4><p>Just like an architect asks about your priorities when designing a house. Do you need a large living room? A spacious kitchen? A home office? — you need to identify what’s most important in your system.</p><p>What components, if not handled properly now, will cost you the most later? Is it data consistency? User authentication? Real-time updates? Payment processing? These critical areas deserve more architectural attention and possibly more sophisticated patterns.</p><p>I worked on an e-commerce platform where the team spent weeks perfecting the user profile component but treated the payment system as an afterthought. Guess which one caused our biggest production issues?</p><h4>3. Think Scalable, Not Fixed</h4><p>The most successful architectures I’ve implemented weren’t fixed structures — they were designed to adapt and scale as the system grew. Think about how your structure can evolve without rewiring whole system.</p><p>For example, you might start with a simple layered architecture for your MVP, knowing you can extract certain domains into separate services later. The key is making sure your initial structure doesn’t prevent future growth — avoid tight coupling and keep your interfaces clean.</p><p>I learned this lesson painfully on a project where we built everything as a tightly coupled monolith “just for the MVP.” When we needed to scale different components independently, we essentially had to rewrite the entire application. A slightly more modular approach initially would have saved months of work.</p><h3>Final Thoughts</h3><p>Here’s what years in this industry has taught me: software architecture isn’t just a solution to solve complex architectural concern — It’s about how your team collaborates, how you make decisions together, and how you evolve your thinking as requirements change.</p><p>The best architectures I’ve worked with weren’t the most sophisticated ones. They were the ones that made sense to everyone on the team, that could adapt to changing requirements, and that didn’t get in the way of shipping features.</p><p>Whether you’re building a simple web app, a complex distributed system, or anything in between, remember this: you’re not just writing code. You’re participating in shaping how your system will grow, how your team will work together, and ultimately, how successful your product will be.</p><p>The architecture decisions you make today echo through every feature you’ll build tomorrow. Make them thoughtfully, with clear reasoning, and always keep your specific context in mind. Your future self — and your teammates — will thank you.</p><h3>A message from our Founder</h3><p><strong>Hey, </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>Sunil</strong></a><strong> here.</strong> I wanted to take a moment to thank you for reading until the end and for being a part of this community.</p><p>Did you know that our team run these publications as a volunteer effort to over 3.5m monthly readers? <strong>We don’t receive any funding, we do this to support the community. ❤️</strong></p><p>If you want to show some love, please take a moment to <strong>follow me on </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>LinkedIn</strong></a><strong>, </strong><a href="https://tiktok.com/@messyfounder"><strong>TikTok</strong></a>, <a href="https://instagram.com/sunilsandhu"><strong>Instagram</strong></a>. You can also subscribe to our <a href="https://newsletter.plainenglish.io/"><strong>weekly newsletter</strong></a>.</p><p>And before you go, don’t forget to <strong>clap</strong> and <strong>follow</strong> the writer️!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4520d577a949" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/do-you-really-need-clean-architecture-for-your-mvp-4520d577a949">Do You Really Need Clean Architecture for Your MVP?</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Overlooked Truth About Getting Things Done]]></title>
            <link>https://medium.com/write-a-catalyst/the-1-productivity-rule-that-changed-everything-1689c0b4956c?source=rss-1170b5949840------2</link>
            <guid isPermaLink="false">https://medium.com/p/1689c0b4956c</guid>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[time-management]]></category>
            <dc:creator><![CDATA[Champani Hamy]]></dc:creator>
            <pubDate>Sun, 21 Sep 2025 06:56:21 GMT</pubDate>
            <atom:updated>2025-10-31T09:06:17.312Z</atom:updated>
            <content:encoded><![CDATA[<h4>The counterintuitive elimination method that helped me build an app, master new skills, and reclaim 730+ hours annually</h4><h3><strong>The day I realized I’d been living someone else’s life</strong></h3><p>Picture this: You’re the person who barely touched social media.</p><p>Facebook? Deactivated most of the time.</p><p>Instagram? What’s that?</p><p>That was me — until peer pressure got the better of me last year.</p><p>One innocent Instagram account later, and suddenly I’m deep in the rabbit hole. You know the one.</p><p>The endless scroll. The “just five more minutes” that turns into an hour.</p><p>The mindless consumption of other people’s highlight reels while your own life sits on pause.</p><p>Last month, I finally had the courage to check my screen time.</p><p><strong>YouTube: 1+ hour daily &amp; Instagram: 1+ hour daily</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xgwnt9GDo3VG8tVL_qmcSA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pQ7lhhmkXlt6npCnT1bvDA.jpeg" /></figure><p>If you’re not a Medium Member, read the full story <a href="https://medium.com/write-a-catalyst/the-1-productivity-rule-that-changed-everything-1689c0b4956c?source=friends_link&amp;sk=87b0727ae12611d6886c63fd6ff9fcd2">here</a>.</p><p>Do the math with me for a second.</p><p>If you spend <strong>1 hour/day on Instagram + 1 hour/day on YouTube = 2 hours/day</strong>, then:</p><ul><li>2 × 365 = 730 hours per year.</li><li>730 ÷ 24 = 30.42 calendar days (about <strong>one month</strong>).</li><li>730 ÷ 8 = 91.25 full 8-hour workdays (≈ <strong>4.56 months</strong> of full-time work).</li></ul><p>So, for a single year of that habit you lose the equivalent of <strong>~30 calendar days</strong> — but more relevantly, <strong>~91 full workdays</strong> of focused effort.</p><p>Framed as concentrated work, that’s almost five months of full-time output gone to passive scrolling.</p><p>That time, I could have spent learning a new skill, building something meaningful, or just being present with the people I love.</p><p>Instead, I was trapped in an infinite feed, getting absolutely nothing in return except anxiety, FOMO, and that weird empty feeling you get after a social media binge.</p><p>Here’s the kicker that really stung: I looked up how much time the creators of these platforms spend on their own apps.</p><p><strong>Less than 10 minutes a day.</strong></p><p>Let that sink in.</p><h3><strong>The brutal truth about success that no one talks about</strong></h3><p>I decided to dig deeper. I studied five incredibly successful people — tech founders, Olympic athletes, business moguls. I wanted to know their secret.</p><p>Plot twist: It wasn’t what I expected.</p><p>Everyone’s obsessed with the “5 AM club.” Wake up early, they say. That’s the magic formula. But here’s what I found:</p><ul><li>Tim Cook starts his day at 4:00 AM</li><li>Warren Buffett rolls out of bed at 6:45 AM</li><li>Some successful people don’t start until 7:00 AM or later</li></ul><p>The timing wasn’t the secret. <strong>Consistency was.</strong></p><p>As James Clear puts it in <em>Atomic Habits</em>:</p><blockquote><em>“You do not rise to the level of your goals. You fall to the level of your systems.”</em></blockquote><p>But here’s where it gets interesting — and where most productivity advice completely misses the mark.</p><h3><strong>Why Your Motivation Is Sabotaging You</strong></h3><p>We’ve all been there. Sunday night planning session. You’re going to wake up early, hit the gym, eat perfectly, work on your side project, read for an hour, and basically become a productivity machine.</p><p>Monday morning: You hit snooze.</p><p>Tuesday: You skip the gym because you’re “too tired.”</p><p>Wednesday: You order takeout and watch Netflix instead of working on your goals.</p><p>By Friday, you’re convinced you have no willpower and you’re just not cut out for success.</p><p>Sound familiar?</p><p>Here’s what science tells us:</p><p>Motivation naturally comes and goes in waves, with our focused attention lasting about 45–90 minutes before we need breaks. Building your entire life around feeling motivated is like building a house on quicksand — it’s going to collapse the moment the weather changes.</p><p>The successful people I studied? They had bad days too. Days when they didn’t feel like it. Days when everything went wrong.</p><p>The difference? They showed up anyway.</p><h3><strong>The Strategy That Actually Works ( And Why Most People Get It Wrong )</strong></h3><p>After experimenting with rigid schedules (and failing miserably), I realized something simple yet powerful:</p><p>Consistency has two dimensions:</p><figure><img alt="Consistency division" src="https://cdn-images-1.medium.com/max/621/1*N8dH0alve331Jt61eDec8Q.png" /><figcaption>Diagram by Author</figcaption></figure><ol><li><strong>Consistency in actions</strong> — what you do daily.</li><li><strong>Consistency in timing</strong> — when you do it.</li></ol><p>Trying to nail both at once usually leads to failure. That’s why so many people hate “time tables.”</p><p>Instead, I began small — focusing first on actions, then gradually aligning timing.</p><p>Here’s what worked for me:</p><h4><strong>Step 1: Audit and Limit Time-Wasters</strong></h4><p>Before you can build something great, you need to stop destroying what you have. Take an honest look at where your time and energy disappear:</p><ul><li>Social media rabbit holes (use those built-in time limits in your phone — they actually work)</li><li>Gossip sessions that leave you feeling drained</li><li>“Friends” who somehow make you feel worse about yourself every time you hang out</li><li>Cluttered physical space</li></ul><p>As Cal Newport says in “Digital Minimalism”: <em>“Clutter is costly.”</em> Every minute spent on something that doesn’t serve you is a minute stolen from something that could.</p><h4><strong>Step 2: Create a practical time table.</strong></h4><p>Now don’t try to be productive in each second. Have room for self care, spending time with loved ones, doing things you love like reading, cycling, gardening or whatever that is important to you.</p><p>And when you make this, always remember to put actions that give you energy at the beginning of your routine such as exercising, having breakfast or spending quick time with your family.</p><p>Then comes the tasks that takes out your energy like your 9–5 job, writing articles or deep work sessions.</p><p>Have some time to recharge in the middle.</p><h4>Step 3: <strong>Stay Consistent in Actions</strong></h4><p>Now take a guide from the time table you created to know where you can spend time and where you can not.</p><p>Each day despite of the time you have chosen, be consistent with your actions.</p><p>This is my proven strategy to stay consistent with the actions.</p><p>Each action you have in your timetable must have a minimal doable task even at your worst day. Even if you’re sick, even if you’re tired, even if you’re emotionally drained, whichever the case may be. Because, let’s be honest, life is life, it has ups and downs.</p><p>So have <strong>a tiny version of your goal</strong> that you can achieve at your best and <strong>most importantly at your worst.</strong></p><p>Here’s the part that changed everything for me. I made them so small they felt almost silly:</p><ul><li>Want to read more? Read just 1 page</li><li>Want to get fit? Do 5 push-ups</li><li>Want better relationships? Have one 5-minute real conversation</li><li>Want to learn something new? Study for 10 minutes</li></ul><p>Stanford researcher BJ Fogg discovered something profound:</p><blockquote><em>“Motivation is unreliable, but tiny behaviors create lasting change.”</em></blockquote><p>The beauty of having tiny version of your task? You literally cannot fail. Even on your worst day — sick, exhausted, emotionally drained — you can still read one page. You can still do five push-ups.</p><p>And here’s the magic: once you start, you often do more. But if you don’t? That’s okay too. You still won.</p><p>Most people obsess over timing.</p><p>“I need to work out at 6 AM.”</p><p>“I must write every day at 5 PM.”</p><p>But if you can’t consistently do the thing at all, when you do it doesn’t matter.</p><p>Focus on building the habit first. Get comfortable with your tiny actions. Build confidence. <strong>Then</strong> — and only then — start nailing down specific times.</p><p>As Darren Hardy explains in “The Compound Effect”:</p><blockquote><em>“Small, smart choices + consistency + time = radical difference.”</em></blockquote><h4>Step 4: <strong>Fix Your Timing Gradually</strong></h4><p>If we start fixing our timing without even being consistent with what we do, it is going to be hard and we are going to damage our confidence with every task that we couldn’t get done.</p><p>That’s proven fastest way to mess your routine.</p><p>Pick one habit. Fix one time slot per week. Let everything else flow naturally until your system is rock solid.</p><p>When we start being consistent with our actions, it gives us confidence to stay in the routine.</p><h3><strong>What Happened When I Actually Did This</strong></h3><p>I’m not going to lie and say it was instant magic. But within a few weeks of following this approach, something shifted.</p><p>I finished the app I’d been “working on” for months. I learned a new programming language. I got in the best shape I’d been in years. Most importantly, I felt like myself again — not some anxious, distracted version constantly comparing my behind-the-scenes to everyone else’s highlight reel.</p><p>The secret wasn’t some revolutionary productivity hack. It was simply this: <strong>consistency beats perfection, every single time.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ms7nUoR4_BrbqcRx" /><figcaption>Photo by <a href="https://unsplash.com/@grstocks?utm_source=medium&amp;utm_medium=referral">GR Stocks</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Your Turn to Reclaim Your Life</strong></p><p>Aristotle had it right:</p><blockquote><em>“We are what we repeatedly do. Excellence, then, is not an act, but a habit.”</em></blockquote><h3><strong>Final Thoughts</strong></h3><p><strong>Consistency, not motivation</strong>, is the secret weapon. When you control your actions and timing — even in their smallest versions — you slowly but surely transform your life.</p><p><strong>Start today:</strong></p><ul><li>Limit the things that drain you.</li><li>Build a routine that energizes you.</li><li>Stay consistent with your actions, then fix your timing.</li></ul><p>Here’s my challenge for you — and I want you to really commit to this:</p><p>Pick just ONE thing. One tiny, almost embarrassingly small action you can take every single day for the next week. Not a complete life overhaul. Not a perfect routine. Just one thing.</p><p>Maybe it’s putting your phone in another room for 30 minutes. Maybe it’s doing 10 jumping jacks. Maybe it’s writing down three things you’re grateful for.</p><p>Whatever it is, make it so small that not doing it feels harder than doing it.</p><p>Then come back here and tell me what you chose. Tell me about your first week. Tell me about the moment you realize you’re not the same person who started this journey.</p><p>Because here’s what I’ve learned: you’re not broken. You don’t lack willpower. You just need a system that works with your human nature instead of against it.</p><p>Your future self is waiting. What are you going to do today to meet them?</p><p><em>Drop a comment below with your one tiny habit. Let’s build this journey together.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1689c0b4956c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/write-a-catalyst/the-1-productivity-rule-that-changed-everything-1689c0b4956c">The Overlooked Truth About Getting Things Done</a> was originally published in <a href="https://medium.com/write-a-catalyst">Write A Catalyst</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Dart Constructors: Named vs Factory vs Static Methods]]></title>
            <link>https://medium.com/@champs_hamy/mastering-dart-constructors-named-vs-factory-vs-static-methods-aacb0c41df7b?source=rss-1170b5949840------2</link>
            <guid isPermaLink="false">https://medium.com/p/aacb0c41df7b</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Champani Hamy]]></dc:creator>
            <pubDate>Sun, 24 Aug 2025 16:21:26 GMT</pubDate>
            <atom:updated>2025-08-25T18:08:23.313Z</atom:updated>
            <content:encoded><![CDATA[<h4>Learn when to use, avoid common pitfalls, and build scalable, maintainable Dart applications with confidence.</h4><p>When working with Dart, one of the most common sources of confusion is understanding the difference between <strong>named constructors</strong>, <strong>factory constructors</strong>, and <strong>static methods</strong>.</p><p>At first glance, they may appear to solve similar problems, but in reality, each has a distinct purpose, set of capabilities, and best use cases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LNocKS3-nWMZbnfn" /><figcaption>Photo by <a href="https://unsplash.com/@flipsnack?utm_source=medium&amp;utm_medium=referral">Flipsnack</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This article will walk you through all three concepts step by step. Instead of just listing definitions, we’ll explore them through a real-world example<strong> </strong>of a Pizzeria app, highlight wrong approaches and why they fail, and finally refine our solution into robust, scalable patterns.</p><p>If you’re not a Medium Member, read full article <a href="https://medium.com/@theapp_forge/mastering-dart-constructors-named-vs-factory-vs-static-methods-aacb0c41df7b?sk=48513997de38fec541e87741d69232b2">here</a> for free.</p><p>By the end, you’ll not only understand the differences but also know when to apply each approach effectively.</p><h3>Requirement</h3><p>We need to build an app for a <strong>Pizzeria</strong>. This Pizzeria has different varieties of pizzas such as <strong><em>New York, Neapolitan</em></strong>, and <strong><em>Chicago</em></strong>. However, all pizzas fundamentally share some common properties: a <em>name</em> and a <em>type</em> (Veg or Non-Veg). The variations come from toppings, crust, and other specifics.</p><p>Our challenge is to design a Pizza class that meets these requirements. While implementing it, we’ll explore different Dart constructor types—<strong>generative constructors, named constructors, factory constructors</strong>—and also compare them with <strong>static methods</strong>. Along the way, we’ll review incorrect approaches too, so you understand <em>why they fail</em> and <em>what to do instead</em>.</p><h3>Step 1: Understanding Constructors in Dart</h3><p>The job of a constructor is simple:</p><blockquote><strong>Create and initialize</strong> a new instance of a class.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*XbKlCDYW9MlhGCS_KFzWkg.gif" /></figure><p>In other words, a constructor:</p><ul><li>Ensure required fields especially final ones are properly initialized.</li><li>Makes sure the object is ready to use.</li><li>Can accept parameters to customize the object.</li><li>Cannot return null or a different type.</li></ul><h3>Step 2: First Implementation — Basic Pizza Class</h3><pre>class Pizza {<br>  final String name;<br>  final String type;<br>}</pre><p>Now, how do we initialize these variables?</p><h4>Approach 1: Initialize at Declaration</h4><pre>class Pizza {<br>  final String name = &quot;NY All Meat Pizza&quot;;<br>  final String type = &quot;Veg&quot;;<br>}</pre><p><strong>Why this is wrong for us:</strong><br>This hardcodes the values. Every instance will always be &quot;NY All Meat Pizza&quot; and &quot;Veg&quot;. We need flexibility to create different pizzas dynamically.</p><h4>Approach 2: Initialize with Constructor Parameters</h4><pre>class Pizza {<br>  final String name;<br>  final String type;<br>  <br>  Pizza(this.name, this.type); // Generative constructor<br>}</pre><p><strong>Why this works:</strong></p><ul><li>We can now create multiple Pizza instances with different values.</li><li>Example:</li></ul><pre>var nyPizza = Pizza(&quot;NY All Meat Pizza&quot;, &quot;Non-Veg&quot;); <br>var napoliPizza = Pizza(&quot;Neapolitan Veggie Delight&quot;, &quot;Veg&quot;);</pre><p>This is good, but not enough for real-world needs.</p><h3>Step 3: Handling JSON Input with Named Constructors</h3><p>Suppose we want to import pizza data from a JSON file. We need another constructor. That’s where <strong>named constructors </strong>come in.</p><p><strong>Incorrect Attempt:</strong></p><pre>class Pizza {<br>  final String name;<br>  final String type;<br><br>  Pizza(this.name, this.type);<br><br>  Pizza.fromJson(Map&lt;String, dynamic&gt; json) {<br>    this.name = json[&#39;name&#39;];<br>    this.type = json[&#39;type&#39;];<br>  }<br>}</pre><p><strong>Why this fails:</strong></p><ul><li>Dart compiler requires that final fields are initialized <strong>before the constructor body executes.</strong></li></ul><h4>Approach 3: Using an Initializer List</h4><pre>class Pizza {<br>  final String name;<br>  final String type;<br><br>  Pizza(this.name, this.type);<br><br>  Pizza.fromJson(Map&lt;String, dynamic&gt; json)<br>      : name = json[&#39;name&#39;],<br>        type = json[&#39;type&#39;] {<br>    print(&#39;Pizza.fromJson(): ($name, $type)&#39;);<br>  }<br>}</pre><p>Now it works — fields are initialized properly. But as requirements grow, this approach needs refinement.</p><h3>Step 4: Refinements Needed</h3><ol><li><strong>Validation</strong>: Pizza.fromJson must filter null values or invalid data.</li><li><strong>Subclassing</strong>: We want subclasses for different varieties (New York, Neapolitan, Chicago).</li><li><strong>Encapsulation</strong>: Users shouldn’t manually pick subclasses. The Pizza class should handle creation.</li></ol><h3>Step 5: Late Variables and Why They’re Tricky</h3><p>One way to delay initialization is late final.</p><pre>class Pizza {<br>  late final String name;<br>  late final String type;<br><br>  Pizza.fromJson(Map&lt;String, dynamic&gt; json) {<br>    name = json[&#39;name&#39;] ?? &quot;Unknown&quot;;<br>    type = json[&#39;type&#39;] ?? &quot;Veg&quot;;<br>  }<br>}</pre><p><strong>Why this is risky:</strong></p><ul><li>late final without an initializer <strong>adds a public setter</strong> until it’s assigned once.</li><li>It weakens immutability guarantees compared to final with initializer lists.</li></ul><p>Better solution? <strong>Factory constructors.</strong></p><h3>Step 6: Factory Constructors</h3><h4>What They Are ?</h4><p>A <strong>factory constructor</strong> in Dart doesn’t always create a new object. It can:</p><ol><li>Perform validation or transformation.</li></ol><p>2. Return a <strong>subclass instance</strong>.</p><p>3. Return a <strong>cached instance</strong> (useful for singletons).</p><p>So it still behaves like a constructor, but with more control.</p><h4>Usage 1 : Improved Example with Validation</h4><pre>class Pizza {<br>  final String name;<br>  final String type;<br><br>  // Generative constructor<br>  Pizza(this.name, this.type); <br><br>  // Factory constructor<br>  factory Pizza.fromJson(Map&lt;String, dynamic&gt; json) {<br>    final name = json[&#39;name&#39;];<br>    final type = json[&#39;type&#39;];<br><br>    if (name == null || type == null) {<br>      throw ArgumentError(&quot;Invalid Pizza data: $json&quot;);<br>    }<br><br>    return Pizza(name, type);<br>  }<br>}</pre><p>Now Pizza.fromJson ensures correctness before creating an object.</p><h4>Usage 2: Subclassing and Encapsulation</h4><pre>abstract class Pizza {<br>  final String name;<br>  final String type;<br><br>  Pizza(this.name, this.type);<br><br>  factory Pizza.variety(String variety) {<br>    switch (variety) {<br>      case &quot;NewYork&quot;:<br>        return NewYorkPizza();<br>      case &quot;Neapolitan&quot;:<br>        return NeapolitanPizza();<br>      case &quot;Chicago&quot;:<br>        return ChicagoPizza();<br>      default:<br>        throw ArgumentError(&quot;Unknown variety: $variety&quot;);<br>    }<br>  }<br>}<br><br>class NewYorkPizza extends Pizza {<br>  NewYorkPizza() : super(&quot;New York All Meat Pizza&quot;, &quot;Non-Veg&quot;);<br>}<br><br>class NeapolitanPizza extends Pizza {<br>  NeapolitanPizza() : super(&quot;Neapolitan Veggie Delight&quot;, &quot;Veg&quot;);<br>}<br><br>class ChicagoPizza extends Pizza {<br>  ChicagoPizza() : super(&quot;Chicago Deep Dish&quot;, &quot;Non-Veg&quot;);<br>}<br><br>// Note: There are more types of pizza for NY variety but that is not intend <br>// to handled in this tutorial</pre><p>Here:</p><ul><li>Pizza.variety(&quot;NewYork&quot;) creates a NewYorkPizza.</li><li>Subclasses are hidden from users.</li><li>Pizza handles object creation internally.</li></ul><h3>Factory Constructors vs Static Methods</h3><p>Many developers confuse factory constructors with static methods. Let’s clear it up.</p><h4><strong>Static Methods are not Not Constructors</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*fInyZM6M1upc-TKNHcvbmw.gif" /></figure><p>A <strong>static method</strong> runs at the <strong>class level</strong>, not on an object. That means:</p><ul><li>It does <strong>not play the constructor role</strong>.</li><li>It can return nothing or manipulate objects, but not for instance creation.</li><li>It has <strong>no access to instance variables</strong>.</li><li>It is used for utility functions or managing non-instance data.</li></ul><blockquote>They serve different purposes.</blockquote><h3>Step 8: Singleton with Factory Constructor</h3><p>Another powerful use of factory constructors is returning cached instances.</p><pre>class PizzaSingleton {<br>  static final PizzaSingleton _instance = PizzaSingleton._internal();<br><br>  // Factory constructors can be unnamed<br>  factory PizzaSingleton() {<br>    return _instance; // Always returns same instance<br>  }<br><br>  PizzaSingleton._internal();<br>}</pre><p>Now, PizzaSingleton() always returns the same object.</p><h3>Final Thoughts</h3><ul><li><strong>Generative constructors</strong>: Great for basic initialization.</li><li><strong>Named constructors</strong>: Useful for clarity and multiple construction patterns.</li><li><strong>Factory constructors</strong>: Add validation, encapsulation, subclassing, and caching.</li><li><strong>Static methods</strong>: Class-level helpers, not constructors.</li></ul><p>If you’ve followed along, you now have a <strong>clear mental model</strong>. Play around with these patterns in Dart. The more you experiment, the more reusable and scalable your designs will become.</p><h3>Keep Building, Keep Refining!</h3><h3>💬 Let’s Chat!</h3><p>Got questions on dart constructors? Drop them in the comments!</p><p>🖱️ <strong>Follow me on Medium</strong> to get more programming content like this.</p><p>👏 If you found this helpful, hit that clap button — it keeps me motivated to write more in-depth guides!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aacb0c41df7b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>