Gemini gate found a real defect that would have shipped: the Linux MTU stream
would have attached to nothing and reported an MTU for a device never.
`devicesChanged` fires only on deviceAdded / deviceRemoved. At the moment a
device is added BlueZ has not finished service discovery, so `gattServices` is
still empty; this plugin waits on `while (!device.servicesResolved)` elsewhere
for exactly that reason. The original patch built its per-characteristic
subscriptions inside that one event, found no characteristics, and had nothing
to re-trigger it when discovery later completed. Verified in the vendored
source, not taken on the reviewer's word.
Now nested: for each device, rebuild the characteristic subscriptions on every
`device.propertiesChanged`, which includes ServicesResolved flipping true. Same
shape the plugin's own `_initFlutterBluePlus` already uses for its logging, so
this is the file's existing idiom rather than a new one.
Also emits once per rebuild (`startWith(device)`), so an MTU already negotiated
before we were listening is reported rather than waiting on a change that may
never arrive. Safe when unknown: 0 is filtered downstream.
Two other findings reviewed and accepted as clean, recorded so they are not
re-litigated: "max across characteristics" is right because the ATT MTU is
per-connection, not per-characteristic; and the web exemption is sound because
the browser owns fragmentation and 172 is far inside the spec's 512-byte
writeValue limit.
analyze clean, format clean, 981 tests pass.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Upstream flutter_blue_plus_linux returns `Stream.empty()` from onMtuChanged,
so no MTU ever reaches Dart on Linux. FlutterBluePlus._mtuValues stays empty,
mtuNow falls back to its 23-byte ATT default forever, effectiveMaxFrameSize
returns the 20-byte floor, and maxChannelMessageBytes clamps to 0. Every
keystroke is then rejected by the length limiter while the field still focuses
and blinks: the #592 symptom, reported on Linux as locked entry fields.
BlueZ does expose the negotiated MTU, as a property on
org.bluez.GattCharacteristic1, surfaced by the bluez package this plugin
already depends on (BlueZGattCharacteristic.mtu). The value was one layer down
the whole time and simply never read.
The patch watches characteristic property changes for 'MTU' and emits a
BmMtuChangedResponse carrying the largest value across the device's
characteristics. They describe one ATT link so they should agree; the max
stops a characteristic that has not been exercised yet, and so reports
nothing, from dragging the figure down. Zero is filtered out, because
FlutterBluePlus would cache it and hand callers something worse than its own
default, and identical consecutive values are suppressed.
Nothing downstream needed changing: the device.mtu subscription added for
Windows in #686 is platform-agnostic, so Linux now gets the same live budget
recovery through the same path.
Also points dependency_overrides at the vendored copy. Third vendored BLE
backend, alongside android (#694) and winrt (#686).
Verified: analyze clean, format clean, 962 tests pass. NOT verified on Linux
hardware; nobody here runs Linux BLE, which is why the gap survived this long.
#717's acceptance requires a real Linux BLE connect showing a non-default
`MTU now:` in the app log.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
CI runs `dart format --output=none --set-exit-if-changed .` across the whole
repo, vendored packages included, so the upstream file's own formatting fails
the analyze check. Third time: #694 hit it on the Android plugin (b33e8485,
chore(#696)) and #686 on the WinRT one.
Formatting only, kept separate so the MTU patch that follows is reviewable
instead of buried in reflowed lines. Re-vendoring upstream later means
re-running dart format on this file.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Pristine import of pub.dev flutter_blue_plus_linux-8.2.2 into packages/,
mirroring the WinRT vendor from #686 and the Android vendor from #695. The
patch rides on top as its own commit so the upstream baseline stays diffable.
Verified against the pub cache with `diff -r --strip-trailing-cr`: all 8 files
identical. FlutterBluePlus License v1.4 and the BSD NOTICE retained unchanged.
No wiring yet: dependency_overrides is not pointed at this copy until the patch
lands, so this commit is inert.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>