Sandro Maglione Profile Banner
Sandro Maglione Profile
Sandro Maglione

@SandroMaglione

3,397
Followers
136
Following
1,162
Media
3,869
Statuses

The Coding Explorer ๐Ÿ’ปใƒปSharing patterns to build type-safe web & mobile appsใƒปTypescriptใƒป @EffectTS_ ใƒปReactใƒปXState Helping devs at ๐Ÿš€

All my free content ๐Ÿ‘‰
Joined January 2018
Don't wanna be here? Send us removal request.
Pinned Tweet
@SandroMaglione
Sandro Maglione
2 months
@EffectTS_ Beginners Complete Getting Started course is out now ๐Ÿš€ From zero to building complete apps with effect Type-safe, maintainable, testable apps, and it's just typescript ๐Ÿ’ฏ Here is what you'll learn ๐Ÿ‘‡๐Ÿงต
5
28
119
@SandroMaglione
Sandro Maglione
3 months
Typescript wizardy: `as const` + `satisfies` Combine both to have type safety on Record keys and values + constant inferred types You can then extract both keys and values as unions using `keyof` and `typeof` ๐Ÿง™
Tweet media one
5
41
375
@SandroMaglione
Sandro Maglione
9 months
๐Ÿ’ก Flutter tip ๐Ÿ’ก Use Isolate to avoid blocking the UI ๐Ÿ‘€ Example: loading a 5Mb txt file as a List takes 17 seconds โฑ๏ธ Without Isolate the UI will freeze during this time ๐Ÿฅถ Wrap with to be safe again ๐Ÿฆบ
Tweet media one
8
41
353
@SandroMaglione
Sandro Maglione
3 months
@DylanoA4 "Orwell feared that what we fear will ruin us. Huxley feared that what we desire will ruin us."
5
27
327
@SandroMaglione
Sandro Maglione
9 months
With macros + primary constructors @dart_lang becomes insane ๐Ÿš€ Example: from a 50+ lines of code to just 1 Stay tuned, because this is going to be game-changing ๐Ÿคฏ
Tweet media one
Tweet media two
8
45
314
@SandroMaglione
Sandro Maglione
9 months
Flutter app in 2024 ๐Ÿš€ ๐Ÿงฌ fpdart ๐Ÿ—๏ธ go_router (with go_router_builder) ๐Ÿฅถ freezed (with json_serializable) ๐Ÿ“ฆ drift (sqlite3) ๐Ÿ”Ž get_it โšก๏ธ signals ๐Ÿงฑ fast_immutable_collections
Tweet media one
12
36
306
@SandroMaglione
Sandro Maglione
1 month
Most underrated react hook: useSyncExternalStore Subscribe to external store changes and extract values in sync with react rendering Ideal for things like event listeners ๐Ÿ’ฏ
Tweet media one
5
19
308
@SandroMaglione
Sandro Maglione
3 months
Important frontend rule: data should be parsed and formatted before reaching the UI Formatting inside a component is problematic ๐Ÿ‘‰ Formatting is computed at every render ๐Ÿ‘‰ Hard to maintain coherent formatting Validate the data at request time
Tweet media one
30
23
287
@SandroMaglione
Sandro Maglione
3 months
Unpopular opinion: a react component should contain few to no business logic ๐Ÿ‘€ A component is only responsible for 1๏ธโƒฃ Display content based on current state/context 2๏ธโƒฃ Send events Everything else should be defined outside
Tweet media one
52
16
283
@SandroMaglione
Sandro Maglione
6 months
Building production-ready typescript apps can be challenging ๐Ÿซฃ As your app becomes bigger, speed slows down, and your pain increases ๐Ÿซ  @EffectTS_ is here to help, this is how ๐Ÿ‘‡๐ŸŽฅ
9
17
241
@SandroMaglione
Sandro Maglione
3 months
`satisfies` makes everything type safe in typescript Combine it with union types and template literals to stop worrying about typos ever again ๐Ÿฅณ
Tweet media one
4
19
238
@SandroMaglione
Sandro Maglione
2 years
Patterns are coming to @dart_lang ๐Ÿš€ (Starting with Records) Wait, what are Patterns? Patterns bring dart to the next level ๐Ÿ“ˆ Here is what we are talking about ๐Ÿ‘‡๐Ÿงต #dart #flutter
8
62
228
@SandroMaglione
Sandro Maglione
11 months
Flutter development kit 2024 ๐Ÿงฌ Core: fpdart ๐Ÿ“š State Management: riverpod (or signals) ๐Ÿ•Š๏ธ Navigation: auto_route ๐Ÿ‘ฅ Models: freezed + equatable + json_serializable ๐Ÿ’‰ Dependency Injection: injectable ๐ŸŒ Requests: http ๐Ÿงช Testing: mockito
15
24
207
@SandroMaglione
Sandro Maglione
2 months
Going ๐Ÿคฏ with local first and @EffectTS_ โ˜‘๏ธ Api with the new `HttpApi` โ˜‘๏ธ PGLite local database โ˜‘๏ธ Drizzle for ORM queries โ˜‘๏ธ Client with Remix โ˜‘๏ธ Turborepo setup All in 2 hours (no AI)! The ecosystem is awesome! ๐Ÿช„
Tweet media one
12
11
205
@SandroMaglione
Sandro Maglione
9 months
New state management in @FlutterDev : signals โšก๏ธ I used signals to implement a complete Flutter app ๐Ÿ“ฒ This is what I learned, and how I am using it ๐Ÿ‘‡๐Ÿงต
Tweet media one
12
20
186
@SandroMaglione
Sandro Maglione
9 months
How you write @dart_lang and @FlutterDev code will soon change forever ๐Ÿš€ 2 new features are coming ๐Ÿ‘‰ Static metaprogramming (macro) ๐Ÿ‘‰ Primary constructors Let me show you why it matters ๐Ÿ‘‡๐Ÿงต
Tweet media one
4
22
182
@SandroMaglione
Sandro Maglione
1 year
Dart 3 is nearly here, brining Patterns and Records with it ๐ŸŽฏ This will radically change how you write @dart_lang (and @FlutterDev ) apps Learn all about them right now ๐Ÿงต๐Ÿ‘‡
Tweet media one
7
31
178
@SandroMaglione
Sandro Maglione
9 months
๐Ÿ’ก Dart tip ๐Ÿ’ก Did you know dart supports destructuring classes? ๐Ÿช„ Class name + `:` followed by property name Patterns are powerful ๐Ÿ”ฅ
Tweet media one
Tweet media two
1
16
169
@SandroMaglione
Sandro Maglione
9 months
๐Ÿ’ก Dart tip ๐Ÿ’ก Different methods to check the value of a variable ๐Ÿ› ๏ธ 1๏ธโƒฃ Repeat == and || for each check 2๏ธโƒฃ Use a List and `contains` ๐Ÿ†• Use `case` since Dart 3 and patterns
Tweet media one
7
20
149
@SandroMaglione
Sandro Maglione
3 months
Typescript-only pattern for full type-safety: constant list + record keys ๐Ÿ‘‰ `as const` to extract values from list as type ๐Ÿ‘‰ `Record` key using elements in the list This *requires* you to add the key to the record if you add a new value to the list
Tweet media one
4
16
145
@SandroMaglione
Sandro Maglione
9 months
What state management package should I use with #flutter ? ๐Ÿค” This week article will give you the answer ๐Ÿ’ก ๐Ÿค riverpod ๐Ÿงฑ bloc ๐Ÿ˜ฑ getx ๐Ÿ†• signals Compare them all and decide ๐Ÿ’๐Ÿผโ€โ™‚๏ธ
Tweet media one
26
19
137
@SandroMaglione
Sandro Maglione
3 months
Underrated state management strategy: Search Params Push the state to the URL with `URLSearchParams` ๐Ÿ‘‰ Less state management logic ๐Ÿ‘‰ Works great with server components ๐Ÿ‘‰ Navigation friendly (e.g. back button)
Tweet media one
11
9
134
@SandroMaglione
Sandro Maglione
6 months
Use @EffectTS_ with @nextjs to implement a Cookies service โœ… Composable โœ… Testable โœ… Framework agnostic And it's just a few lines of code ๐Ÿ’๐Ÿผโ€โ™‚๏ธ This is how step by step ๐Ÿ‘‡๐ŸŽฅ
8
17
129
@SandroMaglione
Sandro Maglione
9 months
๐Ÿ’ก Flutter tip ๐Ÿ’ก Use the `Shortcuts` widget to handle keyboard events ๐ŸŽน This is how to define a type-safe `KeyboardInputWidget` ๐Ÿ‘‡๐Ÿงต
Tweet media one
2
9
128
@SandroMaglione
Sandro Maglione
6 months
๐Ÿ’ก Dart tip ๐Ÿ’ก Patten matching to implement fromJson method ๐Ÿš€ You can use Map in patterns to convert from json ๐Ÿ‘‡ Match the class properties and types, or throw a FormatException
Tweet media one
Tweet media two
3
21
127
@SandroMaglione
Sandro Maglione
2 years
Do not return Future in #dart , it's not safe โš ๏ธ Wait what! What should I do instead? There is an alternative, and it's easier and safer ๐Ÿ’๐Ÿผโ€โ™‚๏ธ It's called Task, let's learn about it ๐Ÿ‘‡๐Ÿงต
8
36
124
@SandroMaglione
Sandro Maglione
11 months
Do you use zod with typescript? Then you must definitely check out @EffectTS_ schema ๐Ÿ”„ Decode and encode ๐Ÿ”— Equivalence โœŒ๏ธ Discriminated unions ๐Ÿช„ Classes ๐Ÿ› ๏ธ Compose ๐Ÿ” Documentation
Tweet media one
6
12
125
@SandroMaglione
Sandro Maglione
3 months
`satisifies`, `as const`, Record, what's the difference in typescript? ๐Ÿง Any typescript wizard must understand these ๐Ÿง™ This is how they all work (combined) ๐Ÿงช
Tweet media one
1
14
120
@SandroMaglione
Sandro Maglione
8 months
๐Ÿ’ก Dart tip ๐Ÿ’ก You can use operators in pattern matching ๐Ÿช„ or, and, ==, <, >, <=, >= and more ๐Ÿš€ You can also wrap the pattern in () to make it more readable ๐ŸŒˆ
Tweet media one
Tweet media two
5
13
118
@SandroMaglione
Sandro Maglione
9 months
๐Ÿ”ฅ Flutter tip ๐Ÿ”ฅ Pattern matching is powerful ๐Ÿš€ You can match both `ConnectionState` and `` with `FutureBuilder` Type-safe, secure, flexible and complete โœ…
Tweet media one
2
10
117
@SandroMaglione
Sandro Maglione
2 months
@embersunn Suggestion: you will probably learn more by picking a project that interests you and implementing it As you face problems you look for solutions and learn new concepts Focusing just on a long list of topics is not so effective with code
4
2
114
@SandroMaglione
Sandro Maglione
2 years
Do you want to make a @FlutterDev app in 2022? ๐Ÿ“ฑ+๐ŸŒ+๐Ÿ’ป The ecosystem is awesome and keeps getting better ๐Ÿš€ Here is what packages you can use for your next app ๐Ÿ‘‡๐Ÿงต #flutter #dart
7
27
112
@SandroMaglione
Sandro Maglione
10 months
End of the year @EffectTS_ magic ๐Ÿช„ This is how I implemented an http request with error handling, validation, full type safety and composition ๐Ÿ”ฅ Using only Effect ๐Ÿ‘‡
Tweet media one
3
10
114
@SandroMaglione
Sandro Maglione
6 months
Macro in @dart_lang 3.4 (behind a flag ๐Ÿšฉ) Work in progress to start experimenting with macros in dart 3.4 (possibly ๐Ÿคž) Example: `fromJson` and `toJson` using `macro` and a method/constructor/class definition ๐Ÿ‘‡
Tweet media one
4
9
114
@SandroMaglione
Sandro Maglione
1 year
fpdart v1.0.0 is out now ๐Ÿš€ This is the biggest release of fpdart ever ๐ŸŽ‰ โœ… #dart 3 โœ… New types โœ… Improved performance โœ… Simplified API โœ… New getting started guide Here is an overview of what's new ๐Ÿ‘‡๐Ÿงต
Tweet media one
4
17
114
@SandroMaglione
Sandro Maglione
2 months
First PGLite local-first example achieved โ˜‘๏ธ @remix_run + PGLite + @vite_js with local database running and working Experimentation in progress ๐Ÿ‘€
Tweet media one
5
8
111
@SandroMaglione
Sandro Maglione
9 months
๐Ÿ’ก Dart tip ๐Ÿ’ก In some cases enum are better than sealed classes ๐ŸŽฏ โœ… Less verbose โœ… Easier to read and use โœ… `.values` to get list of enum
Tweet media one
Tweet media two
Tweet media three
2
14
111
@SandroMaglione
Sandro Maglione
9 months
๐Ÿ’ก Flutter tip ๐Ÿ’ก Since Dart 3 you can use pattern matching on `FutureBuilder` and `ConnectionState` ๐Ÿš€ Never forget to handle a state, no more if/else ๐Ÿค
Tweet media one
Tweet media two
1
18
112
@SandroMaglione
Sandro Maglione
9 months
When macros (static metaprogramming) lands in Dart, everything Dart/Flutter will get to the next level ๐Ÿš€ Give me some time to review this example ๐Ÿ‘€ I'll get back with a full example in a thread soon ๐Ÿงต๐Ÿ‘‡
@spydon
Lukas Klingsbo ๐Ÿ’™๐Ÿ”ฅ
9 months
Macros are live on the Flutter master channel (SDK ), that means you can do the following without any code generation, no freezed and no json_serializable! ๐Ÿ˜๐Ÿคฏ Thanks to millsteed for the example
Tweet media one
30
121
544
4
8
108
@SandroMaglione
Sandro Maglione
8 months
New Extension Types in @dart_lang 3.3 ๐Ÿ”ฅ Make you code even more safe at compile time ๐Ÿงฑ Example: Avoid issues with indexed access on `List` ๐Ÿ‘‡ The best part? No runtime overhead, performance + safety at 0 cost ๐Ÿš€
Tweet media one
3
12
102
@SandroMaglione
Sandro Maglione
2 years
What if your #flutter app fails? Should you throw? Error? Exception? #dart gives you both Error and Exception ๐ŸŽฏ But how do they work? Which one should you choose? ๐Ÿค” Here is the answer ๐Ÿ‘‡๐Ÿงต
3
19
101
@SandroMaglione
Sandro Maglione
9 months
๐Ÿ’ก Dart tip ๐Ÿ’ก Records allow to return multiple values ๐Ÿ“ฆ You can avoid creating a class for simple values, simply use typedef + Records is less verbose ๐Ÿ‘‡
Tweet media one
Tweet media two
3
12
97
@SandroMaglione
Sandro Maglione
11 months
Flutter services kit 2024 ๐Ÿ“ฆ Database: supabase ๐Ÿ•น๏ธ Games: flame ๐Ÿธ Backend: dart_frog ๐Ÿ’ป CLI: args ๐Ÿ”‘ Local storage: isar ๐ŸŒ HTTP client: dio ๐ŸŽ™๏ธ Audio: just_audio ๐ŸŽฅ Animations: flutter_animate ๐Ÿ“น Video: video_player
8
12
99
@SandroMaglione
Sandro Maglione
2 months
@EffectTS_ course release date ๐Ÿš€ My Effect course is coming out on Wednesday, 14 August 10 modules, 55 lessons ๐Ÿ’ฏ From zero to building complete apps with effect Completely free, no email or anything required ๐Ÿ‘‡
Tweet media one
5
15
95
@SandroMaglione
Sandro Maglione
11 months
@nathanbaugh27 The idea that fiction provides less value than non-fiction is flawed Fiction can teach you powerful lessons using the most powerful medium: Stories Read fiction.
4
6
94
@SandroMaglione
Sandro Maglione
3 years
Fpdart, functional programming for @dart_lang and @FlutterDev is now available on pub Why you should check it out ๐Ÿ‘‡๐Ÿงต #flutter #dart #functional #functionalprogramming
Tweet media one
5
34
93
@SandroMaglione
Sandro Maglione
4 months
@EffectTS_ just won the award for the most exciting use of technology 2024 at @thejsnation #jsnation ๐Ÿ† Thanks everyone for the support and the Effect team for the awesome work on the library ๐Ÿ™
Tweet media one
Tweet media two
3
26
94
@SandroMaglione
Sandro Maglione
9 months
Ever heard about signals for state management in #flutter ? ๐Ÿค” New entry in flutter, but looking really promising 1๏ธโƒฃ Define a signal using `signal` 2๏ธโƒฃ Access and update using `value` 3๏ธโƒฃ Wrap with `Watch` to rebuild Yes, it is really this simple, and it just works ๐Ÿ’๐Ÿผโ€โ™‚๏ธ
Tweet media one
6
7
88
@SandroMaglione
Sandro Maglione
10 months
I cannot believe how absurd is the combination of XState and @EffectTS_ Seriously, the experience end-to-end is insane โœ… Visual editor with @statelyai โœ… Actions using Effect โœ… React components only layout and send events ๐Ÿ‘‡ The revolution is coming ๐Ÿš€
Tweet media one
6
8
85
@SandroMaglione
Sandro Maglione
2 years
Do you know @dart_lang ? You should take a look at @typescript โ˜๏ธ I have been working with both for years ๐Ÿค Here is a basic comparison of #typescript from a #dart perspective (and vice versa or course ๐Ÿ’๐Ÿผโ€โ™‚๏ธ) ๐Ÿ‘‡๐Ÿงต
Tweet media one
5
14
82
@SandroMaglione
Sandro Maglione
7 months
The ecosystem for web apps in 2024 is ๐Ÿ’ฏ Just created a new project โœ… @nextjs โœ… @tailwindcss (v4) โœ… @storybookjs โœ… shadcn-ui @shadcn All working together, minimal config, full control ๐Ÿš€
Tweet media one
10
9
82
@SandroMaglione
Sandro Maglione
11 months
Effect + XState + Local First are going to change how you write #typescript code. If you are a web developer you must definitely be aware of these 3 new way of programming that are going to become the standard in Typescript in 2024. @EffectTS_ is a library that exploits the
8
8
85
@SandroMaglione
Sandro Maglione
2 years
Do you know what an *abstract* class is in #dart ? ๐Ÿค” Why not a simple class? Why making it abstract? ๐Ÿ’ญ The distinction is actually important and practical โš™๏ธ Let's see ๐Ÿ‘‡๐Ÿงต
4
14
80
@SandroMaglione
Sandro Maglione
3 years
Look whatโ€™s coming ๐Ÿ‘€ @dart_lang @FlutterDev
Tweet media one
2
11
79
@SandroMaglione
Sandro Maglione
2 months
Adding @DrizzleORM to PGLite is one line ๐Ÿช„ However, now there is another beast to slain: database migrations in local-first Wish me luck on exploring this ๐Ÿซก
Tweet media one
4
3
80
@SandroMaglione
Sandro Maglione
11 months
@mattpocockuk ESLint to the rescue ๐Ÿช„ no-duplicate-enum-values Disallows defining an enum with multiple members initialized to the same value
Tweet media one
4
3
79
@SandroMaglione
Sandro Maglione
8 months
Dart 3 introduces Pattern Matching in @dart_lang ๐Ÿ†• Patterns make your code more safe, and in dart they are super powerful ๐Ÿ”ฅ Here are all the ways you can use patterns in dart (with real examples) ๐Ÿ‘‡๐Ÿงต
2
13
78
@SandroMaglione
Sandro Maglione
9 months
๐Ÿ’ก Dart tip ๐Ÿ’ก Destructuring Lists ๐Ÿ—๏ธ โœ… Single elements โœ… Skip elements with `_` โœ… Destructure in lists with `...` ๐ŸŒˆ Combine them all โš ๏ธ The list must have the elements in that position
Tweet media one
Tweet media two
0
10
75
@SandroMaglione
Sandro Maglione
9 months
๐Ÿ’ก Dart tip ๐Ÿ’ก Sum a list using Pattern matching ๐Ÿ”ฅ ๐Ÿ‘‰ Match an empty list or a list with 1 element ๐Ÿ‘‰ Use a Rest pattern (...) to call `sum` recursive
Tweet media one
Tweet media two
6
3
73
@SandroMaglione
Sandro Maglione
9 months
๐Ÿ”ฅ Flutter tip ๐Ÿ”ฅ I like to define constants inside an abstract class (instead of global const variables ๐Ÿ™…โ€โ™‚๏ธ) With this I can simply use `Constants.` and group all constant under a common class name ๐Ÿช„
Tweet media one
Tweet media two
11
7
73
@SandroMaglione
Sandro Maglione
9 months
Flutter and dart are ๐Ÿ”ฅ ๐ŸŒŠ `drift` sqlite database to store and stream state updates ๐Ÿ”Ž Pattern matching to handle loading and errors ๐Ÿงฌ fpdart type-safe and composable api Type safe, fast, maintainable ๐Ÿš€
2
11
73
@SandroMaglione
Sandro Maglione
2 months
Separate UI from state ๐Ÿ’๐Ÿผโ€โ™‚๏ธ The UI is only responsible for 1๏ธโƒฃ Render layout based on current state 2๏ธโƒฃ Send events All the state management logic should be defined outside the component Key for maintainable state management ๐Ÿ”‘
Tweet media one
2
7
71
@SandroMaglione
Sandro Maglione
9 months
Flutter State Management in 2024 ๐Ÿ’ก Riverpod, Bloc, Signals, GetX How are they different? Which one should you use for you app? ๐Ÿค” This is my experience with all of them ๐Ÿ‘‡
2
21
72
@SandroMaglione
Sandro Maglione
4 months
Stop using server actions, there is a better way, it's called @EffectTS_ rpc ๐Ÿ‘€ โœ… Type safe error handling โœ… As simple as a function call โœ… Full control on request and response When you start using it it works like magic ๐Ÿช„
Tweet media one
Tweet media two
Tweet media three
2
4
72
@SandroMaglione
Sandro Maglione
3 years
Another new feature coming in #dart ๐ŸŽ‰ ๐Ÿ‘‡
Tweet media one
2
11
71
@SandroMaglione
Sandro Maglione
9 months
๐Ÿ”ฅ Flutter tip ๐Ÿ”ฅ Use Records ๐Ÿ’๐Ÿผโ€โ™‚๏ธ When a type does not need members or methods Records are ๐Ÿช„ โœ… Equality by value โœ… Named โœ… Less verbose I am using them everywhere ๐Ÿ‘‡
Tweet media one
Tweet media two
3
6
70
@SandroMaglione
Sandro Maglione
9 months
๐Ÿ’ก Dart tip ๐Ÿ’ก ๐Ÿ‘‰ Callable objects Allow an instance of your Dart class to be called like a function Add a `call` method and you can execute it directly from the class instance ๐Ÿช„
Tweet media one
2
2
70
@SandroMaglione
Sandro Maglione
3 years
As promised, a new article on @stripe and @supabase_io is online! Learn how to use Supabase+Stripe to build your next awesome project ๐Ÿš€
1
8
68
@SandroMaglione
Sandro Maglione
1 year
Coming tomorrow, mark the date ๐Ÿ—“๐ŸŽฏ
Tweet media one
@SandroMaglione
Sandro Maglione
2 years
Full of features, example, tips, and new ways of writing @dart_lang code ๐Ÿ’ป Coming next week ๐Ÿ‘‡๐Ÿ”œ
Tweet media one
0
2
34
5
3
68
@SandroMaglione
Sandro Maglione
11 months
๐Ÿ”ฅ Flutter tip ๐Ÿ”ฅ How to extract elements with a type from a list? You can use where + is ๐Ÿ’๐Ÿผโ€โ™‚๏ธ But, did you know about whereType? ๐Ÿ‘‡ Just specify the type and your are done ๐Ÿช„
Tweet media one
1
4
67
@SandroMaglione
Sandro Maglione
9 months
โšก๏ธ Flutter tip โšก๏ธ Private constructors allow to require a class to use a factory constructor ๐Ÿ› ๏ธ This is useful when you want to control internal values ๐Ÿ”— This is how it works ๐Ÿ‘‡๐Ÿงต
Tweet media one
3
8
67
@SandroMaglione
Sandro Maglione
9 months
๐Ÿงฑ State management with bloc ๐Ÿงฑ Pro โœ… - Clear separation state/events - Clear flow (event ๐Ÿ‘‰ state) - Cons โ›”๏ธ - Dependencies between blocs - Issues with missing and nested providers
Tweet media one
Tweet media two
6
5
64
@SandroMaglione
Sandro Maglione
10 months
๐Ÿ’กUpdate on XState + Effect๐Ÿ’ก If you thought this combination was great, think again ๐Ÿค” It's not just "great", it's mind blowing ๐Ÿš€ Add also @statelyai editor in the mix and ๐Ÿช„ Just like with @EffectTS_ , once you experience this there is no coming back
Tweet media one
2
7
65
@SandroMaglione
Sandro Maglione
7 months
๐Ÿš€ Dart tip ๐Ÿš€ Convert a callback API to Future ๐Ÿ’ก Use `Completer` to create a Future from scratch ๐Ÿ‘‰ Call `complete` when the execution is done ๐Ÿ‘‰ Return `future` Example: `Timer` from callback to Future ๐Ÿ‘‡
Tweet media one
3
5
65
@SandroMaglione
Sandro Maglione
1 month
XState Complete Getting Started Guide is out now ๐Ÿš€ Learn the power of actors and statecharts to manage the state of your app with XState Here is what you'll learn ๐Ÿ‘‡๐Ÿงต
2
13
64
@SandroMaglione
Sandro Maglione
3 months
type or interface in typescript? It depends, but! โ˜๏ธ ๐Ÿ‘‰ Hovering on `type` you see all the properties ๐Ÿ‘‰ Hovering on `interface` shows only the name Keep this in mind when choosing one or the other
Tweet media one
6
6
63
@SandroMaglione
Sandro Maglione
2 years
Environmental variables are convenient in every project Do you know how environmental variables work in Flutter? Let me show you ๐Ÿงต๐Ÿ‘‡
1
10
63
@SandroMaglione
Sandro Maglione
2 years
Supabase v1.0 for Flutter is nearly out ๐ŸŽฏ Authentication with @supabase is just a few lines of code ๐Ÿช„ Learn how to go from 0 to a Complete Authentication system in minutes using #flutter and #supabase ๐Ÿ‘‡
1
13
61
@SandroMaglione
Sandro Maglione
1 year
riverpod + fpdart finally joining forces ๐Ÿค Part 4 of the fpdart + riverpod series is out now ๐ŸŽ‰ Learn how to use the riverpod generator with fpdart, connecting all together and displaying the UI ๐ŸŽจ
3
7
62
@SandroMaglione
Sandro Maglione
2 years
The 'as' operator in #dart is evil ๐Ÿ˜ˆ 'as' will break your app without you noticing How? Example: what is the result of this *valid* code ๐Ÿ‘‡? Let me tell you... ๐Ÿ‘‡๐Ÿงต
Tweet media one
10
11
57
@SandroMaglione
Sandro Maglione
9 months
๐Ÿ’ก State management with Riverpod ๐Ÿ’ก ๐Ÿ‘‰ watch/read all necessary state ๐Ÿ‘‰ Provide state/events to the UI Also here the logic is all hidden inside each provider Clear separation of concerns ๐Ÿ‘
Tweet media one
2
7
60
@SandroMaglione
Sandro Maglione
2 years
Error handling is crucial for any app โš› It can make or break your app (literally ๐Ÿ’๐Ÿผโ€โ™‚๏ธ) #dart offers many tools to save you from troubles ๐ŸŽฏ Here they are ๐Ÿ‘‡๐Ÿงต
1
11
60
@SandroMaglione
Sandro Maglione
6 months
XState is the perfect example of @EffectTS_ on the frontend ๐Ÿ”ฅ Manage all the logic of your app using the power of state machines and Effect Future (present) of frontend state management ๐Ÿ‘‡
Tweet media one
3
5
58
@SandroMaglione
Sandro Maglione
10 months
XState unlocks writing real react components ๐Ÿช„ All the logic is defined inside the machine The component is only responsible for 1๏ธโƒฃ Display the layout based on the current state 2๏ธโƒฃ Send events
Tweet media one
0
4
57
@SandroMaglione
Sandro Maglione
11 months
Response type validation is also important. Another step is adding `effect/schema` or `zod` to validate the shape of the response Complete type-safety, avoid a lot of headaches
Tweet media one
@housecor
Cory House
11 months
How I use React query: 1. Create custom hooks that wrap related useQuery and useMutation calls. 2. Inline queryFn and mutationFn args. This enforces always using React query to query and mutate. 3. Colocate related queries and mutations in the same file, and invalidateQueries
Tweet media one
53
111
1K
2
3
57
@SandroMaglione
Sandro Maglione
6 months
Don't be scared, @EffectTS_ is just typescript ๐Ÿ’๐Ÿผโ€โ™‚๏ธ That's what makes it great ๐Ÿ”ฅ It's easy to convert values and functions to Effect, sync, async, error handling, and more ๐Ÿ‘‡๐ŸŽฅ
3
8
57
@SandroMaglione
Sandro Maglione
1 year
fpdart is now an official #FlutterFavorite package @FlutterDev @dart_lang Thanks everyone for the support ๐Ÿš€ Here are some key moments in the history of fpdart ๐Ÿ‘‡๐Ÿงต
Tweet media one
8
6
56
@SandroMaglione
Sandro Maglione
7 months
fpdart v2 http request ๐Ÿš€ โœ… Error handling โœ… Dependency injection โœ… Type safety โœ… Easy to test It's never been so easy ๐Ÿช„ Here is how ๐Ÿ‘‡๐Ÿงต
Tweet media one
4
11
55
@SandroMaglione
Sandro Maglione
2 years
Records and Patterns are in @dart_lang ย ๐Ÿš€ It's time to start working with them, switch to the main channel ๐Ÿ’ป
Tweet media one
3
5
54
@SandroMaglione
Sandro Maglione
2 years
Records are coming to dart ๐ŸŽฏ A lot of work in progress on this ๐Ÿ‘ท๐Ÿปโ€โ™‚๏ธ๐Ÿ‘‡
Tweet media one
6
10
54
@SandroMaglione
Sandro Maglione
10 months
Web development tech stack 2024 ๐Ÿงฌ Core: @EffectTS_ ๐Ÿ—๏ธ State management: @statelyai + XState ๐ŸŽจ Styling: @tailwindcss ๐Ÿงช Testing: @vitest_dev + @ApiMocking ๐Ÿงฑ Validation: @EffectTS_ Schema ๐ŸŽฅ Animation: @framer motion
4
5
52
@SandroMaglione
Sandro Maglione
11 months
@housecor To make this even easier you can use eslint-plugin-deprecation It reports as error every function marked with deprecated Easy to avoid legacy code ๐Ÿ’๐Ÿผโ€โ™‚๏ธ
Tweet media one
2
1
51
@SandroMaglione
Sandro Maglione
2 months
Live queries with PGLite + @DrizzleORM ๐Ÿง™ Combine drizzle query builder, compile it to sql, and pass it to PGLite live query Sync changes with local db at lighting-speed โšก๏ธ
Tweet media one
2
6
52
@SandroMaglione
Sandro Maglione
6 months
Did you know you can create games with Typescript? ๐Ÿ‘€ I used @excaliburjs with @EffectTS_ to setup a game scene, all Typescript ๐Ÿ”ฅ Add XState @statelyai as well for next level results ๐Ÿš€ And it's all just Typescript โœจ
Tweet media one
4
6
52
@SandroMaglione
Sandro Maglione
19 days
@EffectTS_ with React 19 is out right now ๐Ÿš€ I packed everything that I learned using Effect on React 19 production codebases in one complete project template All for free ๐Ÿ†“๐Ÿ‘‡
1
6
52
@SandroMaglione
Sandro Maglione
7 months
Static metaprogramming is moving ๐Ÿ‘€ Currently "Being implemented" by the @dart_lang team Follow along, this could be huge ๐Ÿš€
Tweet media one
Tweet media two
3
6
51
@SandroMaglione
Sandro Maglione
3 years
Amazing extension, believe it or not I did not know it existed, and it's game-changing! Huge thanks to @gaetschwartz ๐Ÿ”ฅ
Tweet media one
3
9
49
@SandroMaglione
Sandro Maglione
3 months
Typescript generics in React components ๐Ÿง™ Did you know generic types can be used also in react? You can make sure the `name` of your form inputs conform to the shape of your schema Brings better type safety also on the frontend ๐Ÿš€
Tweet media one
3
7
51