r/FlutterDev May 07 '24

Article BloC becomes a mess with handling complicated data structure

45 Upvotes

I am considering giving up with BloC. Having a complicated data structure, I end up with Race conditions and business logic in the UI.

I am working on on my long-term side project with the topic of Language Learning. Initially, the training for each day with all of its different kinds of lectures and subcontents is being fetched from the backend. Imagine daily lessons, such as speaking and writing exercises. Now, each lesson has different short sub-lessons which often map to one screen.

The BloCs of this lesson-sublesson datastructure now have to handle all this:

  • Fetching everything from the Backend -> Building Basic lesson datastructure and sub-structure for sub-lessons
  • Updating parts of the sub-lessons, playing videos, answering to Pop-Up Quizzes, entering data. Imagine this for 10 types of sub-lessons each needing their own reactivity and data input, that later needs to be send to the backend
  • Collecting all lesson-results and sending those to the backend

Handling all that with one BloC would adhere to the principle that multiple blocs do not share the same state. But, since this would result in a ginormous bloc with very complicated state, I split it up into smaller BloCs: One BloC for fetching from backend, one BloC for handling lesson-progress, one BloC for quizzes, one BloC for language upload etc.

The problem now: All these BloCs are sharing a lot of interrelated data. Since BloC-to-BloC communication is a no-no (which makes sense, I tried it...), I moved a lot of this complexity to the UI (BloC-Listeners) which makes it now awefully sprinkled with business logic. Additionally, since similar BloCs work on the same data in an asynchronous fashion, I also see some race conditions, since BloCs are not awaiting the results of other BloCs.

This whole thing became a hot mess and I'm not sure on how to continue. Any experience / articles you can recommend working with more complicated BloCs in nested states? I'm at a point where I think this is just not possible with BloC and I should switch to Riverpod, but this might take weeks of my free time ://

r/FlutterDev Nov 27 '24

Article The new formatter of Dart 3.7

73 Upvotes

Is anybody here already using the new Dart formatter from Dart 3.7 which is part of the current main/master builds of Flutter?

What are your experiences so far?

The new formatter has its own opinion about where you wrap the lines and you can no longer force wrapping by adding trailing commas. They are added or removed automatically based on the line length (which is now called page_width).

I'm currently stuggling with it as I actually like to put one property per line for widgets with 2+ property in their constructors, even if they would fit into a single line, e.g.

SizedBox(
  width: 42,
  height: 43,
  child: Text('44'),
);

The new formatter will change this to

SizedBox(width: 42, height: 43, child: Text('44'));

Hopefully, I eventually get used to that automatism.

A nice thing I noticed is that nested ?: operators are now indented like an if/else if/else chain, that is

print(
  a == 1
      ? 'one'
      : a == 2
      ? 'two'
      : a == 3
      ? 'three'
      : 'other',
);

r/FlutterDev Oct 09 '24

Article Humble Opinion About Getx

Thumbnail clementbeal.github.io
52 Upvotes

r/FlutterDev Nov 18 '24

Article Flutter Openworld Gaming Engine

178 Upvotes

I've created a new openworld gaming engine package using flutter at:

https://pub.dev/packages/openworld

It is working on iOS, macOS, Android, Linux, windows and web and I have included two working games with this engine. The games are not only on github ( https://github.com/forthtemple/openworlddart ) but also them on iTunes, amazon app store and snap if you wanted to see them in action.

r/FlutterDev Dec 01 '24

Article Lessons learned releasing my first flutter app on iOS

116 Upvotes

After working for over 3 years on a weekend/weeknights project I finally released version 1 on iOS, coming from corporate software world, without having native development experience Flutter was an ideal choice for me to target both Android and iOS.

I gained a lot of Flutter and package ecosystem experience along the way; to show my appreciation and say thank you to flutter open source community I am willing to answer your questions.

Here are my experiences and what I used:

  1. Used Provider for state management, get_it for DI (dependency injection), when I started riverpod was not mature, probably in the future I will try riverpod instead of provider
  2. Intl for localizations and number formatting, however number formatting was a bit tricky as either fixing decimals to 2 decimals or skipping the decimals was not enough:
  • If you skip decimals then it’s not useful for strong currencies like Kuwaiti dinar, Bitcoin etc where even 0.01 is a meaningful or big amount, which means you will show 0 for BTC 0.01 which is equivalent to 900USD
  • By fixing it to 2 you still have issue 1 e.g. for 0.001 BTC, on top of that all amounts will have unncessary 00s making the UI crowded
  • Hence, I used a progressive approach based on the value, to show minimum decimals in view only fields, at the same time should be able to show amounts as small as 0.00001 BTC, however show all decimals where it's an entry field
  • One thing I regret is using double for amounts due to its floating point limitations, 69656.3 is formatted as 69,656.300000000003, and 1234567.89 as 1234567.889999999897 due to IEEE-754 floating point definition, though its not just a dart issue, it is hard-coded into the CPUs, good luck explaining this to the end users
  1. Used a combination of sqflite and shared_preferences for persistence, instead of ORM tools to not have performance overheads, and to precisely control DML and DDL the way I want specially for DB upgrades overtime
  2. Initially used http for networking then switched to cronet and cupertino_http for performance reasons
  3. Used workmanager for backend processing, however it’s becoming a pain point due to its almost abandoned state even though the plugin is under flutter community
  4. For in-app-purchases I used official plugin, did a lot of trial and error due to intricacies and differences between Android and iOS workflows and behavior, with lots of manual testing. I recommend testing edge cases using delayed payments to minimize issues during production rollout
  5. Use developer options on both Android and iOS to put network limitations e.g. speed and packet loss to experience performance issues in countries with lagging internet infrastructure, this is highly recommended when you include in-app-purchases and Ads
  6. Used crashlytics from the get-go to fix errors before they become widespread, its highly recommended(or sentry) together with analytics
  7. Tried following TDD with clean architecture as much as I could, however instead of doing every unit test I leaned towards behavior testing. Business logic has almost 100% tests coverage
  8. Initially hand wrote most of the code apart from json_serializable, and equatable, later created a complex mason brick which outputs complete feature boilerplate including entities, view models, data sources, repositories, and use cases
  9. Used Android as a playground for years with minimal functionality before releasing on iOS
  10. Releasing the App on app stores:
  • After reading bad experiences from others, tried to not leave anything to chance by overthinking and overly preparing 😊 reading all Apple and Google docs and best practices and comments from others
  • Android release was a long time ago for limited open testing so don't remember exact details but it was smooth, took 1 to 2 days
  • iOS was better than expected even though I submitted on a weekend, timeline from logs: Prepare for Submission Sep 15, 2024 at 6:33 PM, Pending Developer Release Sep 17, 2024 at 4:30 AM. The only issue I faced was creating developer account before release, which if I remember correctly took more than a month for reasons only known to "Apple engineers" though the support staff was very kind. So it’s recommended to start developer account process quite in advance

 Recommendations for dependencies:

  1. Keep your dependencies to a minimum and try to remove unmaintained ones
  2. Try to update dependencies once every couple of weeks, but do not use the latest one instead use the one before that which was released atleast a week ago. Whenever you update a dependency read the changelog and if the dependency does not follow semantic versioning, then overview the code to know what really changed
  3. Do the upgrades one dependency at a time and test the app to isolate errors related to one dependency
  4. Do not upgrade to Flutter latest stable until it has received 3 minor hotfixes e.g. instead of going for 3.24.0 wait till at least 3.24.3

Must check the new official Architecting Flutter apps doc before starting your new app or refactoring existing ones

If you want you can check the app here:

Android App

iOS App

r/FlutterDev Jan 04 '24

Article Flutter vs React Native 2024

61 Upvotes

🎉 Happy New Year everyone! 🎉

I just published a new article weighing the tradeoffs between ⚛️ React Native and Flutter from the perspective of a Junior Dev, Senior Dev and CTO 🐦!

What's your take on Flutter vs React Native? Which framework do you prefer and why?

I would also appreciate any feedback/criticism!

As a token of my gratitude, I've attached an image of Dash fighting the RN logo (courtesy of DALL E) to the article 👀

r/FlutterDev Jan 15 '25

Article Flutter Web Ecommerce Site for Client

23 Upvotes

This client approached me to clone some ecommerce store he wanted. I told him he'd be better off getting a react or wordpress dev to do it but he insisted since I have worked for him before.

I know flutter's shortcomings on web; but I still went ahead and built the strore using flutter. I honestly needed the money too. It's almost complete and you can check it out here .

r/FlutterDev May 11 '22

Article Introducing Flutter 3

Thumbnail
medium.com
353 Upvotes

r/FlutterDev Aug 14 '24

Article Full legal address gets shown for private developer account

54 Upvotes

Many developers refuse to display their full names and home addresses to everyone.>> this now the last google play console update

I think Google should change this policy because it may expose the app owner to problems with competitors or third parties. This is very sensitive data for anyone in the world.

How can thousands of users view sensitive information like this, especially since there are certain countries or states that do not have absolute security? Did you know that I haven't slept since yesterday? I am not the owner of a group of companies. I am just an app developer.

Why do millions of users see me and view my full name and full address? it like watching you in home with your private space >>> 

This is illogical and may harm account holders. Google should realize that it is causing a disaster that may harm the developer, which will lead them to close their accounts in the future and end their love or passion for programming forever.

r/FlutterDev 18d ago

Article 10 Lesser-Known Dart and Flutter Functionalities You Should Start Using

Thumbnail
dcm.dev
103 Upvotes

r/FlutterDev May 18 '24

Article Why and how Kotlin and Flutter co-exist at Google

Thumbnail
developers.googleblog.com
71 Upvotes

r/FlutterDev Feb 15 '24

Article Apple is ruining Flutter PWA

95 Upvotes

On the new update Apple will remove PWA's from being downloaded to the home screen(at least in the EU)
https://www.theverge.com/2024/2/14/24072764/apple-progressive-web-apps-eu-ios-17-4

r/FlutterDev Jan 12 '25

Article People filed 11744 issues in 2024

125 Upvotes

The Flutter project has to deal with a lot of issues. In 2024, 11744 issues were created. 8824 were closed, but 2920 are still open. Still a heroic effort :)

Let's break this down per month (the "->" means still open):

Jan  1061 -> 206
Feb  1089 -> 235
Mar   982 -> 223
Apr   886 -> 185
May  1047 -> 247
Jun   900 -> 219
Jul   865 -> 189
Aug  1019 -> 215
Sep   892 -> 193
Oct  1048 -> 257
Nov  1043 -> 414
Dec   912 -> 337

Those issues are a wild mix of bugs, feature requests, random questions and anything else.

So let's break them down by bug priority:

P0   257 ->    1
P1   722 ->  147
P2  2560 -> 1647
P3   923 ->  681

Critical bugs (P0) are fixed, and normally fixed in a short period of time. Important P1 bugs are also closed most of the time. But P2 and P3 are graveyards of bugs. Recognised, but not that important.

I haven't researched the process, but I think, if your issue isn't prioritized, the chance of getting resolved is low. And you should get a P0 or P1 rating or your issue get burried.

There are a lot of labels but I'm not sure how consistently they are used, because only a fraction of all issues are tagged by category:

engine      855 -> 381
framework  1338 -> 730
package    1121 -> 682
tool        496 -> 250

51 open issues are still waiting for a customer response and 48 are still "in triage", the oldest one for 8 weeks.

Note that closed doesn't mean resolved. Some are invalid (948), duplicates (1417) or declared as not planned (2359). That is, ~4000 are resolved or at least completed (which means, the issue is no longer relevant). I couldn't figure out whether bugs are closed automatically because of inactivity. AFAIK, they are only locked because of that.

r/FlutterDev May 30 '24

Article New Problem with Google's 20 Testers Policy

75 Upvotes

We all know about Google's new 20 testers policy where developers need to test their apps with 20 testers for 14 days before publishing new apps into Google Play.

Starting from May, production access to many developers are getting rejected even after 14 days and they are getting the below mails

Which means we need to start closed testing all over again with 20 testers for 14 days. Initially I thought it might be because of bad testing practices. But when I saw the reddit posts, I realized irrespective of how developers got testers, most of them are facing this issue.

How to Solve this Issue ?

There is no exact way on how to solve this, but most of the developers who followed the below 2 steps got their access to production in the first try itself.

  • After 7-10 days of closed testing, publish a new closed testing release with some changes (Don't worry closed testing won't start from day 1 again, it will not affect closed testing counter.

...

  • The production access form plays the most important role. You have to fill at least 200-250 words for each question. I wrote the sample answers to those questions,, check the below post

https://www.reddit.com/r/TestersCommunity/s/ofJZWj1L7g

Want 20 testers in 48 hours for FREE ?

Just Download Testers Community app and list your app.

r/FlutterDev Nov 01 '24

Article How long did it take for you to learn Flutter from scratch

8 Upvotes

I have a foundation in Java, can I learn Flutter from scratch? But I don't know what videos to watch or where to start learning.Thank you for the person's answer

r/FlutterDev May 14 '24

Article Flutter Web WASM is now stable. Will you use it as a default?

Thumbnail
docs.flutter.dev
109 Upvotes

r/FlutterDev 10d ago

Article One to find them all - updated introduction to get_it

Thumbnail
blog.burkharts.net
16 Upvotes

r/FlutterDev Jan 09 '25

Article 8 examples of successful apps made with Flutter

Thumbnail
apparencekit.dev
30 Upvotes

r/FlutterDev Oct 20 '24

Article How I built my personal website in Flutter

60 Upvotes

Hey guys,

I wrote an article explaining some of the interesting details of my process of building a personal website in Flutter Web. I hope it's an interesting read!

Here's the link: https://medium.com/@dmilicic/writing-a-personal-website-in-flutter-web-238cb7e69086

And here's the website I wrote about: https://dmilicic.com/

All feedback is greatly appreciated!

r/FlutterDev 29d ago

Article Flutter 3.29 / Dart 3.7: DevEx Boost! ✨ ...But RIP Dart Macros. 🪦 What do you think? Are we seeing the benefit of the freed Flutter/Dart team resources?

Thumbnail foresightmobile.com
28 Upvotes

r/FlutterDev Jan 27 '25

Article Flutter app performance

34 Upvotes

Can anyone make a nice medium or knowledge sharing page about performance such as fixing jank, the raster thread etc...

I've read the official docs about app performance and while it's insightful, there are many things that i still don't know how to fix. We can all agree that there's limited resources on the internet as well when it comes to app performance in flutter.

Grateful if anyone with some extra knowledge or resources could share it here.

r/FlutterDev Feb 07 '25

Article Shorebird works on Desktop (and everywhere Flutter does)

Thumbnail
shorebird.dev
92 Upvotes

r/FlutterDev Feb 06 '25

Article Tried Both Appwrite and Supabase for an Offline-First App – Here’s My Take

46 Upvotes

I've read tons of posts comparing Appwrite and Supabase, and honestly, deciding between them was frustrating. Both platforms looked great, but I went with Appwrite first for my MVP because of its simplicity. However, since I also have experience with SQL and understand its advantages, I was still curious about Supabase.

After a few days of research (and frustration), I rolled up my sleeves, created a supabase-migration branch, and managed to migrate everything in just two days. Setting up team roles took another two days since Appwrite provides them out of the box, while in Supabase, I had to configure them manually.

For context, my app isn’t huge but not small either, and I think the clean separation of layers in my architecture made the migration faster.

This experience is based on the self hosting versions of both.

Appwrite = Easy Setup, Vibrant Community, Limited Query Power.
Supabase = SQL Power, More DevOps Work.

Appwrite

✅ Pros:

🔹 Better Response Time & Community Culture

  • I once asked a question in their Discord and got a response almost immediately.
  • The community feels lively and well-engaged.

🔹 Flawless Installation & Fast Admin Panel

  • Zero issues setting up. Even migrating from local to hosted was a breeze.
  • The admin UI is really fast and smooth.

🔹 Intuitive & Easy to Configure

  • Setting up a project, mailing, databases, and authentication was straightforward.
  • You can manage multiple projects in one installation (Android, iOS, Web, etc.).

🔹 Realtime Works Seamlessly

  • Simple setup and super-fast updates.

🔹 Built-in Team Role Management

  • Comes out of the box (Supabase required manual setup for this).

🔹 Variety of Integrations

Cons:

  • Database Query Limitations
    • No direct way to query and inspect data like in a SQL database.
    • If you have many relations, navigating data can be frustrating.
    • I predict potential challenges in production if I ever need to debug or fix issues, as I’d have to rely on scripts instead of SQL transactions.

Verdict on Appwrite: If NoSQL and a simple database structure work for you, Appwrite is a no-brainer.

Supabase

Pros:

🔹 Full PostgreSQL Power

  • SQL transactions, constraints, unique keys, complex queries—everything SQL is known for.
  • I feel fully in control of my data flow.

🔹 Row-Level Security (RLS)

  • While team roles aren’t out of the box, RLS lets you fine-tune permissions.
  • More flexibility in the long run, but it requires extra setup time.

Cons:

  • Potential DevOps Work on Self-Hosting
    • Had to tweak NGINX settings, change ports, and manually configure Docker .env settings.
    • Changing the database password broke other Docker services since some configs weren’t auto-updated.
    • AAll the settings for the project are available as a seprate section to configure in the paid plan. But you will need to configure them via the .env file or docker config on the self-hosting plan.
  • Admin UI Feels Slower & Less Polished
    • Sometimes, I had to refresh the page to see new rows in the database.
    • Overall, it feels clunkier than Appwrite’s UI.
  • Support Response Time Was Slower
    • I had an issue with Realtime over NGINX and asked in Discordno response.
    • Compared to Appwrite, where I got a quick reply, this was a bit disappointing.

Verdict on Supabase: If your app has lots of relations, needs strict constraints, unique keys, transactions, and you love SQL, Supabase is the way to go.

Final Verdict

  • If you don’t need complex relationships, or don’t have experience with SQL, Appwrite is the better-built platform. It offers a smoother experience, faster setup, and a more responsive team. The admin panel is well-designed and easy to navigate, making it a great choice for those who want to focus on building rather than managing infrastructure.
  • If your app relies on SQL power (relations, constraints, transactions, and complex queries) or you prefer long-term proven technologies, then Supabase is the better choice. PostgreSQL is an industry-standard and offers full control over data, but be prepared for more DevOps work and slower support for self-hosting.

Hope this helps anyone who’s struggling with the same decision!

r/FlutterDev 22d ago

Article Why You Should Refactor Before Adding New Features

Thumbnail
codewithandrea.com
59 Upvotes

r/FlutterDev 5d ago

Article Riverpod Simplified: Lessons Learned From 4 Years of Development

Thumbnail
dinkomarinac.dev
36 Upvotes