Use AsyncValue.guard rather than try/catch inside your StateNotifier subclasses

If you have many StateNotifier subclasses, using try/catch can be tedious. With AsyncValue.guard you get the same result with less boilerplate. https://codewithandrea.com/tips/async-value-guard-try-catch/

Creată 3y | 19 apr. 2022, 06:20:23


Autentifică-te pentru a adăuga comentarii

Alte posturi din acest grup

Gradle Kotlin DSL (Flutter 3.29)

Apps created with Flutter 3.29 use the new Gradle Kotlin DSL on Android. Some CLI tools don't support the new syntax, yet. https://codewithandrea.com/tips/gradle-kotlin-dsl/

10 mar. 2025, 15:10:06 | Code with Andrea
The flutter run --route argument

Pub.dev has a new chart that lets you see package download counts by version (major, minor, patch). Here's where to find it. https://codewithandrea.com/tips/flutter-run-route/

4 mar. 2025, 10:40:07 | Code with Andrea
Why You Should Refactor Before Adding New Features

A real-world case study about ephemeral vs application state, navigation, scroll controllers, and how refactoring can help you ship new features smoothly. https://codewithandrea.com/articles/why-refac

28 feb. 2025, 13:50:08 | Code with Andrea
Downloads Count by Version on Pub.dev

Pub.dev has a new chart that lets you see package download counts by version (major, minor, patch). Here's where to find it. https://codewithandrea.com/tips/download-counts-by-version/

28 feb. 2025, 09:20:06 | Code with Andrea
Side Effects with ValueNotifier

By registering a ValueNotifier listener, you can perform side effects such as updating controllers, showing dialogs, and performing navigation. https://codewithandrea.com/tips/side-effects-value-notif

27 feb. 2025, 10:20:02 | Code with Andrea
February 2025: Flutter 3.29, Dart 3.7, Shorebird & Jaspr Updates, New Formatting Style, TextFormField Mistakes

Also included: Flutter rendering changes, discontinued official packages, Dart macros update, new Flutter UI challenges from Code with Andrea. https://codewithandrea.com/newsletter/february-2025/

24 feb. 2025, 14:50:16 | Code with Andrea
Wildcard Variables in Dart 3.7

Since Dart 3.7, the _ character is a wildcard variable and you can use it more than once in your code, without causing name collisions. https://codewithandrea.com/tips/wildcard-variables-dart-3-7/

14 feb. 2025, 09:10:07 | Code with Andrea