<?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 Majas Developer on Medium]]></title>
        <description><![CDATA[Stories by Majas Developer on Medium]]></description>
        <link>https://medium.com/@majas.developer?source=rss-166b969a3088------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*9HcpATU4UPz6b99R</url>
            <title>Stories by Majas Developer on Medium</title>
            <link>https://medium.com/@majas.developer?source=rss-166b969a3088------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 08:31:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@majas.developer/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[Flutter Clean Architecture & BLoC… for Babies ]]></title>
            <link>https://medium.com/@majas.developer/flutter-clean-architecture-bloc-for-babies-5d03c3ea7e60?source=rss-166b969a3088------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d03c3ea7e60</guid>
            <category><![CDATA[flutter-bloc]]></category>
            <category><![CDATA[dependency-injection]]></category>
            <category><![CDATA[clean-architecture]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Majas Developer]]></dc:creator>
            <pubDate>Thu, 30 Jul 2026 11:03:56 GMT</pubDate>
            <atom:updated>2026-07-30T11:03:56.401Z</atom:updated>
            <content:encoded><![CDATA[<p>A toy factory, a vending machine, and one tiny joke app — explained so simply your inner 10-year-old will finally <em>get it</em>.</p><figure><img alt="Illustration of a toy factory with three glowing rooms — purple, orange, and teal — representing the three layers of Clean Architecture in Flutter." src="https://cdn-images-1.medium.com/max/1024/1*EZFss3zzA3K9E6dxW3k3fQ.png" /></figure><p>Every Flutter dev has been there. You open a “Clean Architecture” tutorial, and by paragraph two you’re staring at words like <em>“dependency inversion,”</em> <em>“abstraction layers,”</em> and <em>“domain-driven boundaries.”</em></p><p>Cool. Very cool. Still no idea what folder to put my code in.</p><p>So let’s throw all that away and build this the way you’d explain it to a <strong>10-year-old</strong>. No jargon. Just a toy factory, a vending machine, and one tiny real Flutter app you can actually run.</p><p>By the end, you’ll understand:</p><ul><li>Why Clean Architecture has 3 layers, and what each one actually <em>does</em></li><li>What Entities, UseCases, and Repositories really are (no CS degree required)</li><li>How BLoC’s Events and States work, using a vending machine</li><li>How to wire it all together with get_it</li></ul><p>Let’s go. 🚀</p><h3>The Toy Factory 🏭</h3><p>Imagine a toy factory with <strong>three separate rooms</strong>. Each room does exactly one job, and — this is the important part — <strong>nobody mixes jobs</strong>.</p><figure><img alt="Cross-section of a toy factory showing three connected rooms: a rules room, a warehouse room, and a shop window room, representing Domain, Data, and Presentation layers." src="https://cdn-images-1.medium.com/max/1024/1*fYVJES_KDBwYYR9Zst-QnQ.png" /></figure><ol><li><strong>The Rules Room</strong> — knows <em>what</em> a toy is and <em>what</em> can be done with it. Doesn’t care where toys come from.</li><li><strong>The Warehouse Room</strong> — knows <em>where</em> to actually get a toy: a shelf, a truck, the internet.</li><li><strong>The Shop Window Room</strong> — what the kid (the user) actually sees and touches.</li></ol><p>In Flutter, these three rooms have real names:</p><figure><img alt="Clean Architecture Layers" src="https://cdn-images-1.medium.com/max/1024/1*fYThmwzTwlpXMNnELU9YvQ.png" /><figcaption>Clean Architecture Layers</figcaption></figure><p>And there’s one golden rule that makes the whole thing work:</p><blockquote>The Rules Room doesn’t know the other two rooms exist.</blockquote><p>Domain never imports anything from Data or Presentation. It’s like the rules of a board game — they don’t care who’s playing, or whether you’re playing on a wooden table or an iPad.</p><p>Let’s build something real to see this in action: a tiny app that fetches a <strong>random joke</strong> from the internet. 😄</p><h3>🧠 Room 1: Domain — “The Rules”</h3><p>This room has <strong>zero</strong> Flutter, <strong>zero</strong> internet, <strong>zero</strong> database code. Just pure logic. If you deleted Flutter from your computer entirely, this code would still run.</p><figure><img alt="A quiet room filled with rulebooks and blueprints, with no windows to the outside world, representing the Domain layer’s independence from Flutter and the internet." src="https://cdn-images-1.medium.com/max/1024/1*MKI99PrzpQ3DCnWfSZc0tw.png" /></figure><h4>Entity — the toy itself</h4><p>Just data. Nothing fancy.</p><pre>class Joke {<br>  final String text;<br>  Joke(this.text);<br>}</pre><h4>Repository — a promise, not a delivery</h4><p>This says “someone will give me a joke” — but it doesn’t say <em>how</em>.</p><pre>abstract class JokeRepository {<br>  Future&lt;Joke&gt; getRandomJoke();<br>}</pre><p>Think of it like ordering food through a hotel’s room service <em>menu</em>. The menu promises a burger will arrive. It doesn’t tell you which chef is cooking it or which truck delivered the beef.</p><h4>UseCase — one recipe card, one job</h4><pre>class GetRandomJoke {<br>  final JokeRepository repository;<br>  GetRandomJoke(this.repository);<br><br>  Future&lt;Joke&gt; call() {<br>    return repository.getRandomJoke();<br>  }<br>}</pre><p>A UseCase is a recipe card that does exactly <strong>one</strong> thing: “get a joke.” Not “get a joke <em>and</em> save it <em>and</em> log analytics <em>and</em> update the UI.” Just one job, done well.</p><h3>📦 Room 2: Data — “The Warehouse”</h3><p>This room finally gets its hands dirty. It knows about APIs, JSON, and the internet.</p><figure><img alt="A busy warehouse with shelves, a delivery truck, and a conveyor belt, representing the Data layer fetching and packaging information from external sources." src="https://cdn-images-1.medium.com/max/1024/1*r8fYMAXgYOFax1LdIhoU6A.png" /></figure><h4>Model — a toy that knows how to ship itself</h4><p>Same as the Entity, but it knows how to build itself from raw JSON.</p><pre>class JokeModel extends Joke {<br>  JokeModel(String text) : super(text);<br><br>  factory JokeModel.fromJson(Map&lt;String, dynamic&gt; json) {<br>    return JokeModel(json[&#39;value&#39;]);<br>  }<br>}</pre><h4>DataSource — the actual delivery truck</h4><p>Talks to the internet.</p><pre>class JokeRemoteDataSource {<br>  Future&lt;JokeModel&gt; fetchJoke() async {<br>    final res = await http.get(<br>      Uri.parse(&#39;https://api.chucknorris.io/jokes/random&#39;),<br>    );<br>    final json = jsonDecode(res.body);<br>    return JokeModel.fromJson(json);<br>  }<br>}</pre><h4>Repository implementation — fulfilling the promise</h4><p>fulfills the <em>promise </em>made in the Domain layer, using the DataSource.</p><pre>class JokeRepositoryImpl implements JokeRepository {<br>  final JokeRemoteDataSource remoteDataSource;<br>  JokeRepositoryImpl(this.remoteDataSource);<br><br>  @override<br>  Future&lt;Joke&gt; getRandomJoke() async {<br>    return await remoteDataSource.fetchJoke();<br>  }<br>}</pre><p>Notice: <strong>Domain never sees </strong><strong>http or </strong><strong>jsonDecode.</strong> It just trusts the warehouse to deliver what it promised.</p><h3>🎨 Room 3: Presentation — “The Shop Window” (BLoC)</h3><p><strong>BLoC</strong> = <strong>B</strong>usiness <strong>L</strong>ogic <strong>C</strong>omponent. Think of it as a <strong>vending machine</strong>.</p><figure><img alt="A friendly vending machine with a button and screen, illustrating how BLoC turns a button press (Event) into a screen update (State)." src="https://cdn-images-1.medium.com/max/1024/1*7KNZ-FW7mjKK67LMTZjfdQ.png" /></figure><ul><li>You press a button → that’s an <strong>Event</strong>. <em>“I want a joke!”</em></li><li>The machine whirs and does its work.</li><li>It shows something on the little screen → that’s a <strong>State</strong>. <em>“Loading…”</em> or <em>“Here’s your joke!”</em> or <em>“Oops, broken.”</em></li></ul><h4>Event — the button you press</h4><pre>abstract class JokeEvent {}<br>class FetchJokeEvent extends JokeEvent {}</pre><h4>State — what shows on the little screen</h4><pre>abstract class JokeState {}<br>class JokeInitial extends JokeState {}<br>class JokeLoading extends JokeState {}<br>class JokeLoaded extends JokeState {<br>  final String joke;<br>  JokeLoaded(this.joke);<br>}<br>class JokeError extends JokeState {<br>  final String message;<br>  JokeError(this.message);<br>}</pre><h4>Bloc — the machinery inside the machine</h4><pre>class JokeBloc extends Bloc&lt;JokeEvent, JokeState&gt; {<br>  final GetRandomJoke getRandomJoke;<br><br>  JokeBloc(this.getRandomJoke) : super(JokeInitial()) {<br>    on&lt;FetchJokeEvent&gt;((event, emit) async {<br>      emit(JokeLoading());<br>      try {<br>        final joke = await getRandomJoke();<br>        emit(JokeLoaded(joke.text));<br>      } catch (e) {<br>        emit(JokeError(&#39;Could not get a joke 😢&#39;));<br>      }<br>    });<br>  }<br>}</pre><p>And the kid pressing the button:</p><pre>FloatingActionButton(<br>  onPressed: () =&gt; context.read&lt;JokeBloc&gt;().add(FetchJokeEvent()),<br>  child: const Icon(Icons.emoji_emotions),<br>)</pre><h3>🔗 Wiring the rooms together with get_it</h3><p>If Domain, Data, and Presentation never talk to each other directly… <em>something</em> still has to plug them together. That’s the job of get_it — think of it as the <strong>factory manager</strong> who hands the right tool to the right room.</p><figure><img alt="A factory manager character connecting wires between three rooms, representing get_it wiring dependencies between Domain, Data, and Presentation layers." src="https://cdn-images-1.medium.com/max/1024/1*H9e6VyyIRDPZhUd8ye9M-g.png" /></figure><pre>final sl = GetIt.instance; // &quot;sl&quot; = Service Locator<br><br>Future&lt;void&gt; initDependencies() async {<br>  sl.registerFactory&lt;JokeBloc&gt;(() =&gt; JokeBloc(sl()));<br>  sl.registerLazySingleton&lt;GetRandomJoke&gt;(() =&gt; GetRandomJoke(sl()));<br>  sl.registerLazySingleton&lt;JokeRepository&gt;(() =&gt; JokeRepositoryImpl(sl()));<br>  sl.registerLazySingleton&lt;JokeRemoteDataSource&gt;(<br>    () =&gt; JokeRemoteDataSourceImpl(sl()),<br>  );<br>  sl.registerLazySingleton&lt;http.Client&gt;(() =&gt; http.Client());<br>}</pre><p>The UI never builds a JokeBloc by hand. It just says sl&lt;JokeBloc&gt;() — <em>&quot;give me a joke bloc&quot;</em> — and get_it hands back one that&#39;s already fully wired, batteries included.</p><h3>🔄 Watch the whole flow</h3><pre>Kid presses button<br>   ↓<br>FetchJokeEvent            (Presentation)<br>   ↓<br>JokeBloc calls GetRandomJoke     (Domain usecase)<br>   ↓<br>GetRandomJoke calls JokeRepository   (Domain contract)<br>   ↓<br>JokeRepositoryImpl fulfills it via JokeRemoteDataSource   (Data)<br>   ↓<br>DataSource fetches from the internet → returns JokeModel<br>   ↓<br>Repository hands it back up as a plain Joke   (Entity)<br>   ↓<br>Bloc emits JokeLoaded(joke.text)<br>   ↓<br>UI rebuilds and shows the joke</pre><h3>Bro why go through all this trouble? 🤔</h3><ul><li><strong>Swap the joke API tomorrow?</strong> You only touch the Data room. Domain and Presentation don’t even notice.</li><li><strong>Want to test your logic without internet?</strong> Swap in a fake JokeRepository that returns a hardcoded joke instantly — since Domain only depends on an <em>abstract</em> contract, not the real internet-calling class.</li><li><strong>New teammate joins?</strong> They can work on the UI without ever touching the API code, and vice versa. Each room only does its own job — just like the toy factory.</li></ul><p>That’s it. That’s Clean Architecture and BLoC — no CS degree, no jargon, just three rooms and a vending machine. 🧸</p><p>If this clicked for you, give it a clap 👏 — and drop a comment if you’d like a part 2 covering testing each layer in isolation.</p><p>📎 You can find the full sample Joke app (Clean Architecture + BLoC + get_it) on GitHub here: <a href="https://github.com/ameenmajas/joke-app-flutter-clean-architecture.git">joke-app-flutter-clean-architechture</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d03c3ea7e60" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking GitHub Copilot’s Generate Instructions for Flutter Projects]]></title>
            <link>https://medium.com/@majas.developer/unlocking-github-copilots-generate-instructions-for-flutter-projects-6626f4ea82f6?source=rss-166b969a3088------2</link>
            <guid isPermaLink="false">https://medium.com/p/6626f4ea82f6</guid>
            <category><![CDATA[github-copilot]]></category>
            <category><![CDATA[ai-in-development]]></category>
            <category><![CDATA[copilot-instruction]]></category>
            <category><![CDATA[developer-productivity]]></category>
            <category><![CDATA[code-review]]></category>
            <dc:creator><![CDATA[Majas Developer]]></dc:creator>
            <pubDate>Fri, 05 Sep 2025 04:30:42 GMT</pubDate>
            <atom:updated>2025-09-05T04:30:42.681Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bODrcasfD3qamduivl1NMA.png" /></figure><h3>Introduction</h3><p>The way we build software is changing rapidly. Productivity and working standards are no longer just about writing code faster — they’re about understanding context, project structure, and coding practices at scale. With the rise of agent-model coding assistants, developers can go beyond autocomplete and actually <strong>teach AI to work with their own coding style and architecture</strong>.</p><p>But here’s the catch: most developers are still using tools like GitHub Copilot only for code completion, missing out on one of the most powerful new features — <strong>Generate Instructions</strong>.</p><p>This feature lets you guide Copilot to not just write code, but to understand your <strong>project architecture, folder structures, naming conventions, and coding practices</strong>. In this article, I’ll show you how this works with a Flutter project and why it can become a game-changer in <strong>code reviews, team collaboration, and project maintainability</strong>.</p><h3>Why Generate Instructions Matters</h3><p>In real-world projects, every team follows slightly different structures. For example:</p><ul><li>Some projects use <strong>feature-first architecture</strong>, while others prefer <strong>layered architecture</strong>.</li><li>Teams may enforce <strong>naming conventions</strong> for widgets, providers, or services.</li><li>Code review often gets stuck on <strong>stylistic or structural issues</strong>, not actual logic.</li></ul><p>With <strong>Generate Instructions</strong>, you can explicitly tell Copilot how to <strong>understand and follow your project’s structure and guidelines</strong>, reducing friction and ensuring consistent contributions.</p><h3>Example with a Flutter Project</h3><p>Let’s say we’re working on a Flutter app that follows <strong>feature-first architecture</strong>:</p><pre>lib/<br> ├── features/<br> │    ├── auth/<br> │    │    ├── presentation/<br> │    │    │    ├── login_screen.dart<br> │    │    ├── data/<br> │    │    │    ├── auth_repository.dart<br> │    │    ├── domain/<br> │    │    │    ├── user_model.dart<br> │    ├── dashboard/<br> │         ├── presentation/<br> │         ├── data/<br> │         ├── domain/<br> ├── core/<br> │    ├── utils/<br> │    ├── widgets/</pre><p>Now imagine you want Copilot to:</p><ul><li>Place new <strong>screens under </strong><strong>presentation/</strong></li><li>Place <strong>repositories under </strong><strong>data/</strong></li><li>Always create a <strong>domain model for any new entity</strong></li><li>Follow your <strong>custom naming conventions</strong></li></ul><p>Instead of manually guiding Copilot every time, you can write <strong>instructions once</strong>. For example:</p><pre># Instructions for this project<br>1. Follow feature-first folder structure.<br>2. Place UI components in `presentation/`.<br>3. Place repositories in `data/` and make sure they extend `BaseRepository`.<br>4. Place models in `domain/` with `Model` suffix.<br>5. All files must use snake_case naming.</pre><p>With this in place, Copilot will generate code that respects your conventions — saving you time and reducing code review back-and-forth.</p><h3>How to Enable Generate Instructions</h3><p>Enabling this feature in <strong>GitHub Copilot</strong> is simple:</p><ol><li><strong>Update Copilot Extension<br>- </strong>Make sure your IDE (VS Code / JetBrains) has the <strong>latest Copilot extension</strong> installed.</li><li><strong>Open Copilot Settings<br>- </strong>In VS Code:<br>- Go to <strong>Settings &gt; GitHub Copilot</strong>.<br>- Look for <strong>Generate Instructions (Experimental)</strong>.</li><li><strong>Add Your Instructions File<br>- </strong>Create a .copilot folder in your project root.<br>- Add a file named instructions.md (or rules.md).<br>- Write your <strong>architecture rules, naming conventions, and coding<br>standards</strong>.</li><li><strong>Activate It<br>- </strong>Once saved, Copilot automatically starts using these rules to generate suggestions.</li></ol><h3>Why This Helps in Code Reviews</h3><p>Traditionally, code reviews often flag things like:</p><ul><li>“This file should go under data/ not presentation/.”</li><li>“Rename this to follow snake_case.”</li><li>“Model files should end with Model.”</li></ul><p>With <strong>Generate Instructions</strong>, Copilot already knows your rules. This means:</p><ul><li>Fewer review cycles.</li><li>Cleaner pull requests.</li><li>Reviewers can focus on <strong>logic and performance</strong>, not folder naming.</li></ul><h3>Final Thoughts</h3><p>The future of coding isn’t just faster typing — it’s <strong>smarter collaboration between developers and AI</strong>. GitHub Copilot’s <em>Generate Instructions</em> lets you take ownership of your coding standards and embed them into your workflow.</p><p>As a Flutter developer, this means <strong>consistent project structures, better code quality, and more productive code reviews</strong>. If you’ve been using Copilot only for autocomplete, it’s time to level up.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6626f4ea82f6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>