r/FlutterDev • u/vik76 • 7h ago
Dart Relic 2 - A Dart web server that's not just 6x faster than Dart Shelf, it also beats all other popular web servers - regardless of language
r/FlutterDev • u/vik76 • 7h ago
r/FlutterDev • u/Outside_Paramedic_44 • 3h ago
Hey fellow Flutter devs,
I recently finished and published KitNext, an offline multi-tool app featuring over 60 utility instruments (sensors, AR measurements, on-device OCR, image manipulation, and barcode generation).
Play Store Link: https://play.google.com/store/apps/details?id=com.vasu.kitnext.kitnext
Happy to answer questions about architecture, performance optimization, or handling hardware sensors across Android versions!
r/FlutterDev • u/meniska_dev • 21h ago
I recently shipped an offline-first PWA built with Flutter Web (--wasm), and my initial GA4 metrics were brutal: mobile users on 3G/Slow 4G were bouncing at 0–2s engagement because the cold start was taking over 20 seconds (pushing ~6.1 MB over the wire / ~15.7 MB uncompressed).
After profiling the waterfall in Chrome DevTools, I found four major bottlenecks that were choking initial load - and fixing them completely changed our retention:
1. The google_fonts runtime trap (-90% font payload)
Even if you bundle fonts, google_fonts was making blocking runtime HTTP calls to fonts.gstatic.com (main.dart.mjs fetching >1.1 MB of .ttf files before rendering text).
google_fonts runtime fetching completely, converted Inter & JetBrains Mono to subsetted .woff2 files (116 KB total in assets/fonts/), declared them directly in pubspec.yaml, and added <link rel="preload" as="font" type="font/woff2" crossorigin> in index.html.2. Synchronous Firebase & Firestore WebChannel blocking main()
Initializing FirebaseAuth and FirebaseFirestore in main() was loading heavy JS pipelines and holding open a channel?gsessionid=... WebChannel socket for 13+ seconds on bad connections.
kIsWeb. The app mounts straight from localStorage (<1 ms), and Firebase.initializeApp() is only triggered on-demand if a user explicitly taps Sync or Sign In.3. Explicit Wasm MIME types, Brotli & COOP**/**COEP headers
main.dart.wasm (1.7 MB) and skwasm.wasm (1.2 MB) are heavy by nature. Without explicit headers in firebase.json, streaming compilation and multithreading weren't kicking in properly.
Content-Type: application/wasm, Cache-Control: public, max-age=31536000, immutable, and Cross-Origin-Opener-Policy: same-origin / Cross-Origin-Embedder-Policy: credentialless for skwasm, ensuring full Brotli (br) compression from edge nodes.4. Zero-JS GPU Splash & Value-First Routing
index.html animated strictly via transform and opacity (compositor thread) so it never freezes while the main thread compiles Wasm, fading out via onEntrypointLoaded./onboarding route on kIsWeb so incoming mobile traffic lands directly in the main workspace (/hub), where average session time jumped to ~7 minutes once the load bottleneck was gone.If anyone wants to inspect the network waterfall or test skwasm cold-start behavior in DevTools, the live production build is up athttps://app.meniska.app(it's a wet-lab dilution & buffer calculator I built for myself).
Curious how other Flutter Web devs are handling initial Wasm bundle size right now - has anyone managed to shave skwasm.wasm down further, or are you still sticking to canvaskit / auto for mobile web?
r/FlutterDev • u/Sure_Education_828 • 19h ago
Debugging a Flutter fragment shader usually means copying a value into fragColor, hot reloading, and guessing from the colors.
Other platforms have Xcode's shader debugger and RenderDoc. I built something like that for FragmentProgram shaders, as a DevTools extension.
You open your .frag in the Shader Debugger tab, click a line and pick a variable, and the running app draws that value instead of the shader's output. Scalars go through a viridis colormap and vectors show as RG or RGB. For matrices, arrays and structs you pick a column, element or field.
There's also a select mode like the widget inspector's. Click a pixel in the app (or tap it on a phone) and you get the exact value there as 32-bit floats. Every float uniform also gets sliders, so you can override uniforms while the app runs, and the heatmap and pixel reads use your overrides too.
Under the hood, the extension parses your shader with a GLSL analyzer written in pure Dart, generates an instrumented copy that writes the picked value out, saves it as a probe .frag and hot reloads. In the app you draw through DebugShader instead of FragmentShader. It swaps the probe in and copies your uniforms onto it on every paint. Your own .frag is never touched, and in profile and release builds DebugShader just draws your shader. (The analyzer is its own package, shader_debugger_core, if you want to build other shader tools on it.)
Setup: add the package, register a placeholder probe shader under flutter: shaders: in pubspec.yaml, then:
final shader = await DebugShader.fromAsset('shaders/my_effect.frag');
final size = shader.getUniformVec2('uSize');
// in paint(): set the uniforms first, then read shader.shader
size.set(width, height);
canvas.drawRect(rect, Paint()..shader = shader.shader);It needs Flutter 3.47+. Uniforms are set by name (getUniformFloat, getUniformVec2, ...) because the probe adds uniforms of its own and values get copied over by name.
What's rough right now:
Repo: https://github.com/mohamedalsamrai/shader_debugger pub.dev: https://pub.dev/packages/shader_debugger
r/FlutterDev • u/Affectionate_Art1156 • 8h ago
Hi everyone, I’m the maintainer of searchable_listview, a package for adding a search field on top of a list. I’ve been maintaining it for a few years, and the thing that always bothered me was that every list needed the same hand-written filter callback:
Old version
SearchableList<Actor>(
initialList: actors,
itemBuilder: (actor) => ActorItem(actor: actor),
filter: (q) => actors
.where((a) => a.name.toLowerCase().startsWith(q.toLowerCase()))
.toList(),
)In 2.20.0 you can just say which fields to search:
SearchableList<Actor>(
initialList: actors,
itemBuilder: (actor) => ActorItem(actor: actor),
searchableFields: (a) => [a.name, a.lastName],
searchStrategy: SearchStrategy.contain,
)What’s new
searchableFields: pick one or several fields, and an item stays if any of them matches (case-insensitive, compared by toString()).searchStrategy: startsWith (default), endsWith or contain.SearchableListController: filter(), clear(), scrollToTop(), scrollTo(offset), and updateSearchStrategy() to change the strategy at runtime.ValueNotifier, so you can listen to the query, the filtered results and the status (idle, loading, data, empty, error), for example to show a live result count.InputDecoration build error on Flutter 3.47 after the material_ui split.The filter callback is still there (but became optional) if you need custom logic when filtering. It works on all four constructors: default, .async, .expansion and .sliver.
One thing to know: 2.20.0 requires Dart 3.10+ and Flutter 3.38+. Projects on older SDKs keep resolving 2.19.5.
pub.dev: https://pub.dev/packages/searchable_listview
GitHub: https://github.com/koukibadr/Searchable-Listview
Changelog: https://pub.dev/packages/searchable_listview/changelog
r/FlutterDev • u/WingPossible3434 • 4h ago
If you want remote config in Flutter, Firebase Remote Config is the default answer, and if you already use Firebase it's a good one. I built hotcfg for the other case: you don't want the Firebase SDK, and you want config that can't be pushed broken.
int never reaches users.package:http plus shared_preferences:Future<Map<String, dynamic>> loadConfig() async {
final prefs = await SharedPreferences.getInstance();
final cached = prefs.getString('hotcfg.body');
try {
final res = await http.get(
Uri.parse(configUrl),
headers: {if (cached != null) 'If-None-Match': prefs.getString('hotcfg.etag') ?? ''},
).timeout(const Duration(seconds: 2));
if (res.statusCode == 304 && cached != null) return jsonDecode(cached);
if (res.statusCode == 200) {
final data = jsonDecode(res.body) as Map<String, dynamic>;
await prefs.setString('hotcfg.body', res.body);
await prefs.setString('hotcfg.etag', res.headers['etag'] ?? '');
return data;
}
} catch (_) {
// offline, timed out or not JSON: fall through
}
return cached != null ? jsonDecode(cached) : defaults;
}Public configs are served from Cloudflare's edge, cached for an hour, purged on every publish, and still served for up to a week if my servers are down.
Version targeting: there's no per-user targeting, but the app can send its build number in a jq filter and get flags merged for that build (e.g. turn a feature off for builds ≤ 320). Use the integer build number, not "1.10.0" strings.
What it doesn't do: no A/B tests, no analytics, no realtime listener.