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
An iterator-like interface for stream values.

Allows more elegant and flexible solutions than default "for"

https://api.flutter.dev/flutter/dart-async/StreamIterator-class.html

#tip #dart #stream
๐Ÿ‘4
Avoid these dart libraries. Briefly about their drawbacks and better alternatives.
https://lazebny.io/avoid-these-dart-libraries/

#flutter #flutterdev #dart
๐Ÿ‘15๐Ÿ”ฅ6๐Ÿค”4๐Ÿ‘2๐Ÿ‘Œ1๐Ÿ’ฏ1
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, which is 50x faster than dart's "image" package.

I think this is not the best solution and if you know how to improve it, it would be greatly appreciated! :)

#dart #rust #ffi
๐Ÿ‘12โค3
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
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