Mobile Tech
1.19K subscribers
103 photos
10 videos
6 files
144 links
Michael Lazebny's blog about @dart and @flutter
lazebny.io
Download Telegram
I have started working on my next article, which is about semantics and accessibility in Flutter.

We will discuss how to design components to make them accessible to users. You will learn how to use the Semantics widget correctly and understand the differences between semantics properties and widgets. Finally, I will demonstrate how to debug accessibility, write tests, and confirm that you are heading in the right direction.
πŸ”₯12πŸ‘3😁2❀1😱1
I will be presenting β€œPerformant Scrolling Layouts with Slivers” on Fluttercon in Berlin!
6πŸ”₯15❀‍πŸ”₯2
Are you going to Fluttercon?
Final Results
13%
Yes
75%
No
13%
Thinking
4🀨3
I've been using geminicommit cli for some time for creating commits. And it actually creates good commits. Much better than Cursor or Copilot "generate with AI" function. Moreover, this is entirely free as gemini has very generous free tier (100 API requests per day for 2.5 Pro and 250 RPD for 2.5 Flash).

Currently, I use 2.5 Flash as it generates commits faster and still reliable (I also had some issues with 2.5 pro errors)
1πŸ‘12❀1
Mobile Tech
I have started working on my next article, which is about semantics and accessibility in Flutter. We will discuss how to design components to make them accessible to users. You will learn how to use the Semantics widget correctly and understand the differences…
So.. plans slightly changed.. and I have written an article about basics of Domain-Driven design πŸ˜„. Specifically, about subdomains.
I have recently started exploring the concepts of DDD and find its practices and approaches helpful in writing code.

The article is free of charge, please share what you think!
https://lazebny.io/domain-driven-design-core-supporting-generic-subdomains/

P.S. I'm planning to update old articles with new details. After that, I would like to continue this architectural series. Next article might be about modeling business logic using ideas from DDD and Clean Architecture.
πŸ‘9πŸ‘2😁2πŸ€”2πŸ”₯1
Mobile Tech
Rust is an amazing language for FFI in Dart All you need to do is define the extern C function, run cbindgen to generate a C header file, and then run ffigen, which generates safe Dart bindings. Here is how I implemented upscale using Rust's "image" crate…
Some time ago, I mentioned that I had built a Flutter package for upscaling images using Rust.

Now, the Dart team is working on a 'Native Assets' feature that, in theory, will enable it to be bundled as a Dart package without Flutter required as a dependency! This would make it easier to use the package in the Dart CLI or on the backend.

https://dart.dev/tools/hooks
πŸ‘7
Today I Learned: golden tests are natively supported by flutter_test!
I always thought that for goldens you need to install third-party packages.

To generate goldens, you can use matchesGoldenFile API:
https://api.flutter.dev/flutter/flutter_test/matchesGoldenFile.html
πŸ‘7
When updating dependencies in a Pub Workspace, use "dart pub upgrade," which automatically resolves to the correct version and updates it in every package.

#flutter #FlutterDev #dart #tip
πŸ‘6
A package should do a single thing and do it well.

If the package solves state management, it should expose APIs specifically for that purpose – it should not concern itself with dependency injection or database storage.

A package that has many responsibilities likely tries to connect them under a single API, which adds more coupling and more unknowns to it. Such packages are considered red flags.

Applications built with packages that are "red flags" tend to be "red flags" in terms of maintenance/scalability/performance.

#architecture
πŸ‘8πŸ’―4πŸ‘Ž1
This media is not supported in your browser
VIEW IN TELEGRAM
I created a Shimmer animation in Flutter in 100 lines without libraries.

It is performant and minimizes rebuilds, based on a CustomPaint, a LinearGradient, and a Transform.

https://gist.github.com/hawkkiller/2ed40b43d6372fc322080e0c8ce76521

#dart #flutter #flutterdev
πŸ‘20
Don't use SVGs for Icons in Flutter. There are better and more performant ways.

Rendering SVG requires several time-consuming operations: reading from memory, parsing the SVG to a binary format, parsing the binary format to Dart structures, and only then rendering.

Instead, opt for icon fonts, similar to the Icons class in Flutter. A Flutter engine processes all the fonts during startup and makes them available throughout the whole app lifecycle. The performance of rendering an icon font is the same as rendering text.

#dart #flutter #flutterdev
πŸ‘6πŸ”₯3🌚1
Mobile Tech
Don't use SVGs for Icons in Flutter. There are better and more performant ways. Rendering SVG requires several time-consuming operations: reading from memory, parsing the SVG to a binary format, parsing the binary format to Dart structures, and only then…
I have created SVG vs Iconfont Performance Benchmark

It tracks the rasterization, which is the process of rendering UI objects as pixels on the screen.

The icon font is much better on the GPU thread. SVG's complexity leads to expensive rasterization, which easily overwhelms the GPU and causes stutters.

You can check the full benchmark here https://github.com/hawkkiller/svg_iconfont_benchmark

Note that I tested on my MacBook, which is extremely performant. Testing on a low-end Android device may provide even more insights.

I also tried to add some readmes for better understanding.

#flutter #flutterdev
πŸ”₯9πŸ‘5
There is an easy way to speed up Flutter tests in CI.

If you have a large test suite, use sharding. It distributes the number of tests between multiple shards, so you can create multiple parallel jobs in CI.

#flutter #FlutterDev
πŸ‘8πŸ‘1
Do not hardcode paths to assets; use the path generator!

The generator ensures that assets exist and removes the possibility of a typo.
Explore what fits your needs, but I would recommend flutter_gen/spider.

#flutter #flutterdev
πŸ‘8❀4
It is better to wait before updating Flutter to the latest stable version.

After a new stable, there are usually multiple fixes published – 3.32 had 8 patches!

I recommend staying 1 stable version behind the latest release. This ensures that you won't be affected by regressions and new bugs.

#flutter #flutterdev
πŸ‘15
My first talk on a big conference FLUTTERCON!!!
2πŸ”₯44πŸ‘8πŸ‘7😍1
Is your layout ready for RTL languages?

A common mistake is using a fixed left/right EdgeInsets or Alignment.

Instead, use their directional counterparts. They provide logical start and end properties, allowing the UI to adapt automatically.

#flutter #flutterdev
πŸ‘11❀2