Skip to content

refactor: drop package:flutter imports from filters and vst3 - #616

Merged
alnitak merged 1 commit into
alnitak:mainfrom
hectorAguero:fix/filters-vst3-without-flutter
Nov 22, 2026
Merged

alnitak merged 1 commit into
alnitak:mainfrom
hectorAguero:fix/filters-vst3-without-flutter

Conversation

@hectorAguero

@hectorAguero hectorAguero commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Hey @alnitak, I was updating the fork to try it again, and AI went a bit ahead creating this PR, so I checked and try make it the description clear as possible.

Let me know, if you are fine with it, and if you prefer to have the next PR ready, so both can be reviewed together instead(not in same PR).

Summary

Refs #598 filters/ and vst3/ stop importing package:flutter. No behavior change.

 lib/src/filters/{filters,custom_filter,parametric_eq}.dart
-import 'package:flutter/foundation.dart';   // used only for kIsWeb (+ meta annotations)
+import 'package:meta/meta.dart';             // parametric_eq.dart; the others already had it
+const bool _kIsWeb = bool.fromEnvironment('dart.library.js_interop');
-  if (kIsWeb && soundHash != null) {
+  if (_kIsWeb && soundHash != null) {

 lib/src/vst3/{vst3_host_ffi,vst3_host_web}.dart
-import 'package:flutter/foundation.dart';   // used only for Uint8List
+import 'dart:typed_data';

_kIsWeb is the constant realtime_stream.dart already defines, and the same expression Flutter uses for kIsWeb.

Plan, from #598:

  • This PR: filters/ and vst3/ without package:flutter.
  • Next PR: wrap the PlatformDispatcher.instance.engineId read and the DarwinEngineLifecycle calls in bindings_player_ffi.dart behind a small internal lifecycle class, so a fork replaces that class instead of editing the bindings.
  • Open question for you (next PR): whether Android's nativeLibraryInUse signal goes behind the same class.
  • No PR: asset loading (already split by loader_io.dart / loader_web.dart) and soloud.dart, which keeps compute, defaultTargetPlatform and loadAsset's AssetBundle?. The DartNative fork keeps patching those imports itself.

Evidence

  • Before: git grep "package:flutter/" -- lib/src/filters lib/src/vst3 → 5 imports.
    After: no matches.
  • flutter analyze lib (Flutter 3.50): no issues. dart format --set-exit-if-changed: clean.
  • flutter test test/filter_param_names_test.dart test/filter_type_test.dart test/parametric_eq_test.dart test/vst3_test.dart: 19 passed.
  • flutter build web and flutter build web --wasm on example/: both build.

Merge Danger

Door: two-way. One commit, no public API change; a revert restores the old imports.

Blast Radius: minimal.

The 15 web guards compile to the same constant as before. If Flutter ever redefined kIsWeb, these files would not follow, as realtime_stream.dart already doesn't.

Nothing stops a future package:flutter/foundation.dart import (and kIsWeb) from coming back to these files. The fork's sync check catches that on our side. If it keeps happening, I can propose a small test that fails on Flutter imports under filters/ and vst3/.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

The filters only used kIsWeb from package:flutter/foundation.dart, and the
VST3 hosts only Uint8List. Use a private
`bool.fromEnvironment('dart.library.js_interop')` constant, as
realtime_stream.dart already does, plus package:meta and dart:typed_data.
No behavior change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hectorAguero
hectorAguero marked this pull request as draft November 20, 2026 05:06
@hectorAguero
hectorAguero marked this pull request as ready for review November 20, 2026 05:20
@alnitak
alnitak merged commit 1a753a8 into alnitak:main Nov 22, 2026
1 check passed
@alnitak

alnitak commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Hi @hectorAguero,

I have merged this. The v5.3.2 will soon be available on pub.dev.

I am near to merge #617 which introduces a lot of more tests which found issues that have been fixed. Please refer to that PR's branch in your work for DartNative!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants