r/FlutterDev • • Jul 20 '20

Video How to Implement Dark & Light Theme Using Provider & Hive.

Thumbnail
youtu.be
132 Upvotes

r/FlutterDev • • May 02 '20

Article Amazing Flutter tips from my #100daysOfFlutter Challange, now open-sourced. Let's create a great repo of tips.

Thumbnail
github.com
132 Upvotes

r/FlutterDev • • Oct 05 '19

Video Netflix UI Redesign | Speed Code

Thumbnail
youtu.be
132 Upvotes

r/FlutterDev • • Aug 03 '22

Dart Dart added to LeetCode

131 Upvotes

Now do competitive programming and enhance your data structure knowledge in dart.


r/FlutterDev • • Dec 31 '20

Article The Ultimate List Of Flutter Learning Resources (Over 200!)

Thumbnail
wilsonwilson.dev
131 Upvotes

r/FlutterDev • • Feb 26 '20

Article How I Created a Particle Clock and Won the #FlutterClock Challenge

Thumbnail
ultimatemachine.se
131 Upvotes

r/FlutterDev • • Feb 19 '20

Video Flutter + Unity3D AR Foundation

Thumbnail
youtube.com
131 Upvotes

r/FlutterDev • • Sep 01 '26

Discussion Boss wants to switch our 100K+ user native apps to Flutter for "3x faster" delivery — am I actually biased, or is this a bad call?

130 Upvotes

ong-time mobile/product lead here. Looking for outside perspective because I'm now questioning myself after a long argument with my boss.
Context: I work on external client apps as well as our main customer portal app — the one used by the majority of our customer base. Our mobile apps are native, built about 6 years ago:
Android: Java/Kotlin + XML
iOS: Swift + UIKit
Web: React

100K+ users. Zero limitations adding features or maintaining these apps over the years. Apps are feature rich and AI based new features are in plan for revamp.

What's happening: We have a full revamp of the apps and portal coming up, and we're updating our tech stack too. My plan:
Android → Kotlin + Compose
iOS → SwiftUI
Web → Next.js
I already have multiple Android, iOS, and web devs trained on this stack.

The conflict: My boss wants to consolidate to Flutter — one team, one codebase, covering web/Android/iOS. His argument: if I put 6 frontend devs on one Flutter codebase instead of splitting across native platforms, we ship 3x faster.

My pushback:
We have zero Flutter training on the team right now
Native apps perform better and feel more premium
We have built Flutter apps before, but only for external client projects, not our own flagship product
He thinks I'm biased toward native because it's my background. Might be some truth to that, but I don't think that's the whole story.

Anyone actually shipped a migration like this — native to Flutter, or vice versa, at similar scale? Did the "one codebase, ship faster" promise hold up? Would love real-world experience, not theory.


r/FlutterDev • • Jan 02 '25

Discussion My experience using AI to create an entire Flutter app

130 Upvotes

Over the past month, I’ve been learning Flutter, and I just released my app for closed testing on the Play Store (currently 8/12 testers onboard). For this project, I decided to take a new approach by heavily incorporating AI into the development process. My goal was to explore first hand the limitations of using AI to develop with Flutter and Dart, and to identify what works well and what doesn’t.

Although I have prior development experience in JavaScript and Python, I was new to Flutter and Dart when I started this journey. Here’s how I approached the process:

  1. Learning the Fundamentals: I began by thoroughly reading all the official documentation for Flutter and Dart. I studied each widget, explored different approaches to state management, app architecture, and familiarized myself with general best practices.

  2. Hands-on Practice: Next, I worked through a couple of Google’s Flutter Codelabs. I wrote every single line of code manually—no copy-pasting—so I could truly understand the syntax and workflow.

  3. Building the App: Once I had some foundational knowledge, I set out to develop my app: a certification study helper for a niche subject, Health Information Management Certifications. The app is entirely offline, contains no ads, and is relatively simple. It uses sqflite for storage and provider for state management. *Edit* removed app site link.

The entire development process took about two weeks of nights and weekends. The final product consists of 40 files, 4,989 lines of code, and 155 comments. Interestingly, I estimate that I personally wrote only about 5% of the code.

While AI was a tremendous help, it had some notable challenges:

  • State Management: Handling state changes and keeping provider updated was tricky. I had to refine my prompts to guide the AI more effectively.

  • Feature Updates: Modifying existing features often led the AI to attempt a complete rewrite of the original functionality. Again, clearer prompts helped mitigate this issue.

  • Dependency Handling: The AI sometimes added unnecessary or unused packages, which required manual cleanup.

  • Debugging Approach: It defaulted to adding excessive print statements for debugging, even when simpler methods would suffice.

  • Occasional Incorrect Code: On rare occasions, the AI wrote code that was blatantly wrong but looked convincing. Thankfully, with my coding background, I could identify and correct these errors. For someone with no coding experience, these issues could easily slip through unnoticed.

Overall, using AI was a valuable experiment, and it allowed me to build a simple MVP faster than I could have on my own. That said, a moderately experienced Dart/Flutter developer could likely achieve the same results in the same or less time with fewer challenges. However, I wouldn’t dismiss AI as “incompetent” at development—it proved to be a powerful tool when used thoughtfully.

If you’re interested in trying the app, let me know, and I’ll add you to the closed testing group. I’m also happy to share the system prompt I used during development.

 I used Claude Sonnet 3.5 with their project feature and used the following project instructions:

You are a Flutter/Dart coding assistant specializing in helping developers implement clean and scalable code using the MVVM (Model-View-ViewModel) architecture. Your primary focus is to guide developers in building applications that adhere to the following principles:

 

Separation of Concerns: Ensure a clear distinction between the Model (data and business logic), View (UI components), and ViewModel (state management and business logic interaction with the View).

 

Reactive Programming: Leverage tools like Streams, RxDart, or Riverpod for efficient communication between the ViewModel and View, ensuring the UI reacts to changes in data/state seamlessly.

 

Clean Code Practices: Promote writing modular, testable, and maintainable code, emphasizing DRY (Don't Repeat Yourself), SOLID principles, and effective use of dependency injection (e.g., with GetIt or Provider).

 

Best Practices: Recommend and demonstrate the use of Flutter best practices, including widget composition, state management solutions, efficient API handling, and appropriate error handling.

 

Documentation: Encourage clear and concise documentation in the codebase, including inline comments and code organization for better readability and collaboration.

 

Code Optimization: Provide recommendations to optimize performance, such as efficient widget builds, lazy loading, and avoiding unnecessary rebuilds.

 

You should provide examples, step-by-step explanations, and alternative approaches where applicable. Always assume the user has a basic understanding of Flutter and Dart but is seeking to improve their skills in clean architecture and MVVM implementation.

 

Focus on practical solutions and complete code snippets that the user can directly use in their projects.


r/FlutterDev • • Mar 29 '24

Article Riverpod is not Complicated - Getting Started Guide

130 Upvotes

There seems to be a lot of confusion with Riverpod and the way it is used. Admittedly the documentation is lacking. And for someone getting started, there are many decisions to be made like:

  • Should I use code-generation?

  • How many providers should I create?

  • What should be contained in each provider?

Because of this adaptability, it can become very confusing for someone just getting started. I'm creating this blog post to lay some ground rules that I set for myself when using riverpod. If you're getting started with riverpod, following these rules will be a good starting point.

But before reading on these rules, I highly recommend you checkout these guides in this order:

  1. Flutter Riverpod 2.0: The Ultimate Guide

  2. How to Auto-Generate your Providers with Flutter Riverpod Generator

  3. How to use Notifier and AsyncNotifier with the new Flutter Riverpod Generator

Basics

Because I know some of you are lazy as hell, I'll summarize what I think is important in the below bullet points:

  • Riverpod is like a global variable storage and each provider is it's own global variable.

  • Only special widgets ConsumerWidget and ConsumerStatefulWidget have access to these providers.

  • You can access the providers using ref.read and ref.watch

    • ref.watch is used in the Widget's build method rebuilds the widget the state changes

    • ref.read is used outside of the Widget's build method

  • There are many different types of providers to choose from and the riverpod generator makes it so you don't need to choose which one to use.

  • There are different modifiers you can apply to the provider when accessing it.

    • By default you get the AsyncValue with no modifiers

    • .notifier can be used to access the functions within the provider

    • .future can be used to get the latest value of the state asynchronously

  • An AsyncValue is returned when accessing the provider with no modifiers

    • .when is typically used in the Widget build method

    • .value is to get the current value

Common Pitfalls of Riverpod

Not Using Code Generation

I personally hate code generation. It adds an extra generated file and it abstracts logic that might be important to understand.

Because of reasons above, I decided to give riverpod a try without code generation. After a couple of times, of choosing the wrong provider, encountering bugs because of incorrect parameters, I decided that code generation was the way forward.

After I gave it a shot, everything became simple. It saved me hours of hair pulling trying to configure the correct parameters for each provider. Even the riverpod documentation highly recommends code generation.

Grouping Providers based on Technology

When first working with riverpod, I thought the best approach would be to group global variables by the technology. For example, I had a library for my database, I put all my database related functions in the single provider and called it a day. My thinking was that this was just a global variable storage

But by doing this, I lost a lot of the capabilities riverpod provided out of the box. I had to:

  • Refresh the UI with ref.watch based on specific criteria

  • I had to manage the states myself which added unnecessary complexity

  • Handle the initialization of states and loading states manually

If you want to see how NOT to use riverpod, I encourage you to checkout how I did it incorrectly with Fleeting Notes.

Not Using Streams

Streams are so so powerful. If you have a database that supports streaming I highly recommend you use streams to streamline your setup. There's no more need to handle updates, inserts, or deletes, they are automatically done so with your backend being the source of truth.

Examples

Below are two very common use cases for production applications. One is with authentication and the second is with routing.

Authentication

Below is a simplified version for learning purposes. Checkout the full code here.

@Riverpod(keepAlive: true)
class Auth extends _$Auth {
  // We use a stream controller to control when the stream is updated and what object is in the stream.
  final StreamController<AppUser?> authStateController =
      StreamController.broadcast();

  Auth();

  @override
  Stream<AppUser?> build() {
    // listen to auth state change
    final streamSub = client.auth.onAuthStateChange.listen((authState) async {
      refreshUser(authState);
    });

    // dispose the listeners
    ref.onDispose(() {
      streamSub.cancel();
      authStateController.close();
    });

    // return the stream
    return authStateController.stream;
  }

  supa.SupabaseClient get client => supa.Supabase.instance.client;

  Future<AppUser?> refreshUser(supa.AuthState state) async {
    final session = state.session;
    if (session == null) {
	  // set the auth state to null
      authStateController.add(null);
      return null;
    }

    // Make an additional query to get subscription data
    final metadata = await client
        .from("stripe")
        .select()
        .eq("user_id", session.user.id)
        .maybeSingle();

    // Put together custom user object
    final user = AppUser(
      session: session,
      authEvent: state.event,
      activeProducts: List<String>.from(metadata?["active_products"] ?? []),
      stripeCustomerId: metadata?["stripe_customer_id"],
    );

    // update the stream
    authStateController.add(user);
    return user;
  }
}

Routing

Below is a simplified version for learning purposes. Checkout the full code here.

// This is crucial for making sure that the same navigator is used
// when rebuilding the GoRouter and not throwing away the whole widget tree.
final navigatorKey = GlobalKey<NavigatorState>();
Uri? initUrl = Uri.base; // needed to set intiial url state

@riverpod
GoRouter router(RouterRef ref) {
  // we watch the authState to update the route when auth changes
  final authState = ref.watch(authProvider);
  return GoRouter(
    initialLocation: initUrl?.path, // DO NOT REMOVE
    navigatorKey: navigatorKey,
    redirect: (context, state) async {
      // we redirect the user based on different criteria of auth
      return authState.when(
        data: (user) {
          // build initial path
          String? path = initUrl?.path;
          final queryString = initUrl?.query.trim() ?? "";
          if (queryString.isNotEmpty && path != null) {
            path += "?$queryString";
          }
          // If user is not authenticated, direct to login screen
          if (user == null && path != '/login') {
            return '/login';
          }
          // If user is authenticated and trying to access login or loading, direct to home
          if (user != null && (path == '/login' || path == '/loading')) {
            return "/";
          }
          // After handling initial redirection, clear initUrl to prevent repeated redirections
          initUrl = null;
          return path;
        },
        error: (_, __) => "/loading",
        loading: () => "/loading",
      );
    },
    routes: <RouteBase>[
      GoRoute(
        name: 'loading',
        path: '/loading',
        builder: (context, state) {
          return const Center(child: CircularProgressIndicator());
        },
      ),
      GoRoute(
        name: 'login',
        path: '/login',
        builder: (context, state) {
          return const AuthScreen();
        },
      ),
      GoRoute(
        name: 'home',
        path: '/',
        builder: (context, state) {
          return const HomeScreen(title: "DevToDollars");
        },
      ),
    ],
  );
}

r/FlutterDev • • May 05 '23

Dart Confirmed. Dart 3 on May 10th

Thumbnail
github.com
130 Upvotes

r/FlutterDev • • Aug 15 '22

Community Flutter is really really cool (From a React Developer)

130 Upvotes

Before I even started writing Flutter a lot of React Devs were telling me to stay with React Native and that Flutter is not made for production ready apps (B.S By the way). However RN did not treat me well (tons and tons and tons of errors) even when trying to get to production it was very tedious.

Then transferred to Flutter from RN and of course some things went over my head a day or two, then productivity skyrocketed after grasping the concepts, and knocking out apps in way shorter time frames with better performance.

Just my 2 cents!


r/FlutterDev • • Mar 10 '22

Community The new Here WeGo Navigation app from HERE (Formerly Nokia Maps) is written entirely in Flutter

Thumbnail
developer.here.com
130 Upvotes

r/FlutterDev • • Oct 12 '21

Article Desktop performance deep dive: Flutter vs Electron

Thumbnail
getstream.io
130 Upvotes

r/FlutterDev • • Jan 07 '21

Plugin We made a package for rendering playing cards

130 Upvotes

Hey all, we put together a package called playing_cards that allows you to easily render nice looking cards! Hopefully you guys find this useful and let us know if you have any questions/comments. We also put together a short video describing the main features.

If you use it, I'd love to see what you come up with. Feel free to message me or send me screenshots or something!

pub link: https://pub.dev/packages/playing_cards
github: https://github.com/bedardjo/playing_cards
video: https://youtu.be/f9tOu972nhI


r/FlutterDev • • Nov 28 '20

Video Flutter desktop - custom window titlebar, minimize, maximize, close buttons on Windows

Thumbnail
youtube.com
130 Upvotes

r/FlutterDev • • Oct 06 '20

Article Navigation design patterns with Flutter

Thumbnail
medium.com
130 Upvotes

r/FlutterDev • • Aug 20 '20

Discussion Still in development, but excited to see AWS come to Flutter! Who would use this over firebase?

Thumbnail
github.com
130 Upvotes

r/FlutterDev • • Jan 26 '26

Article Production Postmortem: Why I removed Hive, GetX, and Connectivity Plus from a large offline-first app

129 Upvotes

Hey everyone,

I've been maintaining a production offline-first Flutter app (fintech scale) for the last year, and I wanted to share some "regrets" regarding our initial tech stack choices. We prioritized setup speed (MVP mindset) over architectural strictness, and it bit us hard 6 months post-launch.

1. Hive vs Relational Data: We used Hive for everything. It's fast, but managing relational data (One-to-Many) manually in Dart code led to orphaned data bugs. We also hit OOM crashes on older Android devices during box compaction because Hive (v3) loads boxes into memory. We migrated to Drift (SQLite) for ACID guarantees.

2. GetX vs Lifecycle: GetX is fast to write, but debugging memory leaks became a nightmare. We found that controllers were often disposing too early or persisting too long during complex navigation stacks. We switched to Bloc simply because the "Event -> State" stream is deterministic and easier to unit test.

3. Connectivity Plus: Relying on ConnectivityResult.mobile is dangerous. It tells you if you have a cell connection, not if you have internet. We had thousands of failed sync attempts in "dead zones." We now rely strictly on actual socket pings (internet_connection_checker).

I wrote a full breakdown with the specific failure scenarios and what we replaced each library with on Medium if you're interested in the deeper details:

https://medium.com/@simra.cse/the-5-flutter-libraries-i-regret-choosing-for-production-and-what-i-use-instead-35251865e773?sk=3084ac0bc95e0313d32eac97b92813e4

Has anyone else hit that specific Hive OOM issue on large datasets? Curious if v4 fixes this or if SQLite is still the only safe bet for large offline datasets.

PS: An update, i wanted to share another piece of my mind and came up with another set of plugins which we decided was not good for our app. Since i was working in a large fintech organization, Flutter_Secure_storage package was creating issues. Webview_Flutter created issues last week!!!. I have documented it here, let me know if it resonates with you. And if you feel my chain of thoughts are wrong, let me know that too(PS: Just dont hate dumb- be a little nice). https://medium.com/@simra.cse/5-more-flutter-libraries-i-regret-using-in-production-part-2-a7f8feeb486e?sk=8feb3202b927fc80615bcabb6c9678f7


r/FlutterDev • • Oct 31 '24 Helpful

Discussion Share unknown but very useful hidden gem Flutter and Dart packages!

129 Upvotes

Hello!

Some time ago, there was a post here that I found very useful (the original post. There's a lot of packages these days, many of which are super useful, but don't get the spotlight they deserve. So post the hidden gem packages that you've found to share them with others!

I'll start by listing some from the previous post and my own favorites that I've found useful:

https://pub.dev/packages/boxy this one I found very useful for doing complex widget layouts.

https://pub.dev/packages/retry a super handy package to retry things like HTTP requests when they fail.

https://pub.dev/packages/dio_smart_retry retry interceptor similar to previous package, but for Dio specifically.

https://pub.dev/packages/awesome_extensions this one adds a bunch of useful extensions to pre-existing stuff to reduce boilerplate.

https://github.com/mikededo/dartBarrelFileGenerator not a package, but VSC extension that I use to autocreate barrel files for my own packages.

https://pub.dev/packages/dart_date another extension, saves time and reduces boilerplate when working with Date times.

https://pub.dev/packages/cider awesome CLI tool for creating changelogs. I use this all the time.

https://pub.dev/packages/isolate_manager a very helpful manager to make using isolates much easier.

https://pub.dev/packages/tabbed_view for desktop apps, this one is great if you want to create multiple tabs view. Also, if you only want parts of it, the creator has split this one into separate packages.


r/FlutterDev • • Sep 07 '22

Plugin Introducing: Flutter Animate - gskinner

Thumbnail
blog.gskinner.com
129 Upvotes

r/FlutterDev • • Jan 11 '22

Plugin I have written a pub to do the flipping effect.

129 Upvotes

flip_widget

It is easy to use, like this:

FlipWidget(
    key: _flipKey,
    // The widget you want to flip.
    child: Container(
        color: Colors.blue,
        child: Center(
            child: Text("hello"),
        ),
    ),
)
...
// Show flipping effect
_flipKey.currentState?.startFlip();

// Update
// `percent` is the position for flipping at the bottom
// `tilt` is the `a` of `y=a*x`
_flipKey.currentState?.flip(percent, tilt);
// Dismiss the effect layer and show original widget
_flipKey.currentState?.stopFlip();

r/FlutterDev • • May 20 '21

Article Flutter SDK will be ready for the new 'Material You' design - 9to5Google

Thumbnail
9to5google.com
129 Upvotes

r/FlutterDev • • Mar 30 '21

Dart Announcing Alfred - A super easy, modular, ExpressJS like server package for dart.

129 Upvotes

Hi community!

I have been developing backend servers in dart for some time now, but with the demise of Aqueduct and Angel, I wanted to create something that was accessible and not a monolith. Hence Alfred was born! It's a fully featured ExpressJS like framework for dart that does one thing, and one thing well - serving data.

You can use whichever database or ORM you like, you can fire up server in only a few lines of code:

main() async {
final app = Alfred();
app.get("/example", (req, res) => "Hello world");
await app.listen();
print("Listening on port 3000");
}

It has very limited dependencies, its null safe, and relies heavily on dart's excellent internal libraries - so you are safe to run with it. In fact - it's only about ~150 lines of code (with 100% code coverage). Therefore it's not huge commitment if you want to sub it out later on - not that I expect you will.

I'm going to be migrating my mission critical apps over the next week or so and refining it, but would love your feedback if you want to check it out. There are heaps of simple examples in the Readme such as serving files, json and routing:

https://github.com/rknell/alfred