• Home
  • Insight
  • Blog
  • Business
  • Entertainment
  • Health
  • Politics
  • Shop
    • Gift Shop
    • Value Shop
    • Store
    • Bargain Shop
    • Discount
  • Sports
  • Tech
  • Travel
  • USA
  • Video
  • World
    • Asia
    • Africa
    • South America
    • North America
    • Europe
    • Oceania
Thursday, July 30, 2026
No Result
View All Result
Subscribe Now
  • Home
  • Insight
  • Blog
  • Business
  • Entertainment
  • Health
  • Politics
  • Shop
    • Gift Shop
    • Value Shop
    • Store
    • Bargain Shop
    • Discount
  • Sports
  • Tech
  • Travel
  • USA
    TX Rep. Brandon Gill Mocks James Talarico Over Fauci Action Figure Post

    TX Rep. Brandon Gill Mocks James Talarico Over Fauci Action Figure Post

    NBA players are ‘being taught’ to flop

    NBA players are ‘being taught’ to flop

    Industry was warned for years about chemical ‘runaway’ dangers. Then came near-catastrophe in O.C.

    Industry was warned for years about chemical ‘runaway’ dangers. Then came near-catastrophe in O.C.

    Trump administration seeks government-wide NDAs to stop leaks : NPR

    Trump administration seeks government-wide NDAs to stop leaks : NPR

    Dog discharges shotgun inside truck, striking woman at Nebraska traffic light

    Dog discharges shotgun inside truck, striking woman at Nebraska traffic light

    Toshifumi Suzuki, Japan’s ‘God’ of Convenience Stores, Dies at 93

    Toshifumi Suzuki, Japan’s ‘God’ of Convenience Stores, Dies at 93

     Judge Sanctioned CoreCivic for Destroying Video in ICE Death Suit

     Judge Sanctioned CoreCivic for Destroying Video in ICE Death Suit

    Suspect dead after opening fire near White House security checkpoint, Secret Service says

    Suspect dead after opening fire near White House security checkpoint, Secret Service says

    Trump trashes Colbert’s high-rated finale as “no ratings”

    Trump trashes Colbert’s high-rated finale as “no ratings”

  • Video
  • World
    • Asia
    • Africa
    • South America
    • North America
    • Europe
    • Oceania
The Insight Post
  • Home
  • Insight
  • Blog
  • Business
  • Entertainment
  • Health
  • Politics
  • Shop
    • Gift Shop
    • Value Shop
    • Store
    • Bargain Shop
    • Discount
  • Sports
  • Tech
  • Travel
  • USA
    TX Rep. Brandon Gill Mocks James Talarico Over Fauci Action Figure Post

    TX Rep. Brandon Gill Mocks James Talarico Over Fauci Action Figure Post

    NBA players are ‘being taught’ to flop

    NBA players are ‘being taught’ to flop

    Industry was warned for years about chemical ‘runaway’ dangers. Then came near-catastrophe in O.C.

    Industry was warned for years about chemical ‘runaway’ dangers. Then came near-catastrophe in O.C.

    Trump administration seeks government-wide NDAs to stop leaks : NPR

    Trump administration seeks government-wide NDAs to stop leaks : NPR

    Dog discharges shotgun inside truck, striking woman at Nebraska traffic light

    Dog discharges shotgun inside truck, striking woman at Nebraska traffic light

    Toshifumi Suzuki, Japan’s ‘God’ of Convenience Stores, Dies at 93

    Toshifumi Suzuki, Japan’s ‘God’ of Convenience Stores, Dies at 93

     Judge Sanctioned CoreCivic for Destroying Video in ICE Death Suit

     Judge Sanctioned CoreCivic for Destroying Video in ICE Death Suit

    Suspect dead after opening fire near White House security checkpoint, Secret Service says

    Suspect dead after opening fire near White House security checkpoint, Secret Service says

    Trump trashes Colbert’s high-rated finale as “no ratings”

    Trump trashes Colbert’s high-rated finale as “no ratings”

  • Video
  • World
    • Asia
    • Africa
    • South America
    • North America
    • Europe
    • Oceania
No Result
View All Result
No Result
View All Result
Home Mobile

Flutter Tutorial: Organizing Your Flutter App

by Theinsightpost
August 17, 2022
in Mobile
0 0
0
Flutter Tutorial: Organizing Your Flutter App


Flutter 102 and a half by Scott Stoll

You may have noticed that Flutter apps aren’t organized like other apps. You may have also noticed that there doesn’t seem to be a lot of guidance on how to organise your Flutter app. Let’s dig in.

Flutter app organization rules

It’s kind of like the old movie Fight Club: “The first rule of Fight Club is don’t talk about Fight Club”.

After two years of Fluttering, I haven’t seen many people talking about how to organize an app, either.

Rule #1: There are almost no rules.

This is the source of both freedom and chaos. People know to shove things into their lib directory, and not much else. Some use directories called pages, others routes, some put an asset folder in their lib directory and others have it outside of lib. Which way should you do it?

Rule #2: You don’t have to do what others do.

I’m not about to say what you “should” do, but I’ll tell you what you could do. The best guideline I have is to make sure you, and anyone else maintaining your app, can find what you’re looking for quickly, easily and intuitively. That said, let’s take a look at some options.

Where are your objects?

Are you using encapsulation objects like Models and BLoC? They could have their own place, easy to find and directly under lib. Maybe something like lib/models

You might want to organise those assets.

Oddly enough, this is the one place you see people agreeing that they like to have them outside the lib folder. Even further, it’s a good practice to organize them with subfolders. The asset folder is usually a sibling of lib, not in it. So while your lib folder is at package_name/lib, your asset folder would be at package_name/assets. Then, under assets, we can break each type down into subfolders like:

  1. …/assets/images
  2. …/assets/svg
  3. …/assets/fonts

The app files are crucial.

This is for anything that is app-wide. In Flutter, we often make files for colors, strings, text styles, themes, localization and even variables for asset values and vector graphics. This way all of these values are kept in one, easy to find place that should make life easier for the person who gets stuck with maintaining your app. The examples below were so small I decided to put them in one file, but I’d recommend breaking each class out into its own file, and then putting them somewhere like lib/app.

An AppColors.dart File With Some Material Color Sets Pre-Defined

You probably have a backend.

I mean, your app isn’t all UI, is it? You might want to think about a backend folder, maybe with some subfolders for utils, services, and managers?

lib
...
  backend
    services
    utils
    managers

Data can be real or fake.

Personally, I use a data folder for the real stuff and, inside of it, I place a mock folder for the fake data I use during development.

Pages and Routes.

You’ll probably want to keep all the files that are the base of a page together. They can, and almost certainly will call in all sorts of Widgets, but the file we normally consider the page is the one that has the highest widgets of the tree that are currently being displayed. This is usually a Scaffold and AppBar, but if you’re doing something that’s full-page then this could easily be a Container, Material, Center or SizedBox, too.

Your widgets folder could easily end up being the largest folder in your app. If it’s a Widget that’s smaller than a page or route, then it could go in here. This is especially true of any Widgets that get reused over and over, in many different parts of your app.

The rest of the story…

Wrapping up, for things like Firebase I’ve seen the Firebase related Dart files put in a folder under lib while all of the Firebase files that are not Dart files were put in a Firebase folder directly under the project folder, as a sibling of lib.

In the end, you want to make sure that not only can you find what you’re looking for, but the poor sucker who has to follow you a year from now can easily find what they’re looking for, too.

That means things need to follow a pattern of organization that makes sense to a human being.

So take a moment to ask yourself one, simple question:

“Is the way this is organized understandable to anyone, or only to an engineer?”

As the levels of abstraction in modern frameworks goes higher and higher, people are coming to the software world from all kinds of different backgrounds. This is especially true in Flutter, which is (hopefully) about to be inundated with web developers looking for a better way to write their apps. And don’t forget that Flutter will let them release their creations to a lot more places than just the web.

If you came from Android and want to use a similar organization system with things like res/drawable and res/values, there’s nothing stopping you. There’s no rule that says you can’t, but take a moment to think about this:

Right now, the vast majority of Flutter devs will understand that system without any problem at all because the vast majority of us have at least some experience with Android development, but that’s starting to change. Backend devs who have always wanted to try their hand at front end and mobile are seeing that the learning curve is now easier than ever. To them, front end development suddenly seems like something they might actually have come within their reach. And as I mentioned, we’re probably going to see a lot of web developers branching into Flutter, too.

This means it won’t be long before the majority of Flutter devs don’t have any Android experience, so you might want to think about organizing your app not in a way that today’s Flutter devs will understand, but one that tomorrow’s Flutter devs will.

You can stalk the author on Twitter at @scottstoll2017, or LinkedIn.

Continue with the first Flutter tutorial by Scott Stoll on Flutter Layout System





Source link

ShareTweetSend
Previous Post

Kenya presidential wildcard vows to erase debt with ‘ganja solution’

Next Post

Is Elon Musk really buying Manchester United?

Related News

Announcing Codemagic Patch: an open-source CodePush rebuild for React Native
Mobile

Announcing Codemagic Patch: an open-source CodePush rebuild for React Native

July 30, 2026
React Native OTA Updates: What You Can (and Can’t) Deploy Over the Air
Mobile

React Native OTA Updates: What You Can (and Can’t) Deploy Over the Air

May 28, 2026
Your phone drawer hides an app designed to “exploit developing brains”
Mobile

Your phone drawer hides an app designed to “exploit developing brains”

May 27, 2026
iPhone 16 has a secret charging upgrade Apple didn’t even mention
Mobile

iPhone 16 has a secret charging upgrade Apple didn’t even mention

May 26, 2026
Next Post
Is Elon Musk really buying Manchester United?

Is Elon Musk really buying Manchester United?

Discussion about this post

Subscribe To Our Newsletters

    Customer Support


    1251 Wilcrest Drive
    Houston, Texas
    77042 USA
    Call-832.795.1420
    e-mail – news@theinsightpost.com

    Subscribe To Our Newsletters

      Categories

      • Africa
      • Africa-East
      • African Sports
      • American Sports
      • Arts
      • Asia
      • Australia
      • Business
      • Business Asia
      • Business- Africa
      • Canada
      • Defense
      • Education
      • Egypt
      • Energy
      • Entertainment
      • Europe
      • European Soccer
      • Finance
      • Germany
      • Ghana
      • Health
      • Insight
      • International
      • Investing
      • Japan
      • Latest Headlines
      • Life & Living
      • Markets
      • Mobile
      • Movies
      • New Zealand
      • Nigeria
      • Politics
      • Scholarships
      • Science
      • South Africa
      • South America
      • Sports
      • Tech
      • Travel
      • UK
      • USA
      • Weather
      • World
      No Result
      View All Result

      Recent News

      Free Cloud Computing Course | AWS Re/Start Program 

      Free Cloud Computing Course | AWS Re/Start Program 

      July 30, 2026
      Thirty Years Later

      Thirty Years Later

      July 30, 2026
      Announcing Codemagic Patch: an open-source CodePush rebuild for React Native

      Announcing Codemagic Patch: an open-source CodePush rebuild for React Native

      July 30, 2026
      Following Expansion in China, Regional Private Equity Faces New Scrutiny in Southeast Asia – The Diplomat

      Following Expansion in China, Regional Private Equity Faces New Scrutiny in Southeast Asia – The Diplomat

      July 30, 2026
      • Home
      • Advertise With Us
      • About Us
      • Corporate
      • Consumer Rewards
      • Forum
      • Privacy Policy
      • Social Trends

      Theinsightpost ©2026 | All Rights Reserved. Theinsightpost is an Elnegy LLC company, registered in Texas, USA

      Welcome Back!

      Login to your account below

      Forgotten Password?

      Retrieve your password

      Please enter your username or email address to reset your password.

      Log In

      Add New Playlist

      We are using cookies to give you the best experience on our website.

      You can find out more about which cookies we are using or switch them off in .

      No Result
      View All Result
      • Home
      • Insight
      • Blog
      • Business
      • Entertainment
      • Health
      • Politics
      • Shop
        • Gift Shop
        • Value Shop
        • Store
        • Bargain Shop
        • Discount
      • Sports
      • Tech
      • Travel
      • USA
      • Video
      • World
        • Asia
        • Africa
        • South America
        • North America
        • Europe
        • Oceania

      Theinsightpost ©2026 | All Rights Reserved. Theinsightpost is an Elnegy LLC company, registered in Texas, USA

      The Insight Post
      Powered by  GDPR Cookie Compliance
      Privacy Overview

      This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

      Strictly Necessary Cookies

      Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.

      Cookie Policy

      More information about our Cookie Policy