// lib/src/smart_text_flutter.dart:9
static final _smartTextFlutter = SmartTextFlutterPlatform.instance;
This captures the platform instance once, at class load. Any later assignment to SmartTextFlutterPlatform.instance has no effect.
That defeats the override point plugin_platform_interface exists to provide, and it is why the plugin is awkward to fake in tests.
It also blocks desktop and web support. Flutter registers Dart-only platform implementations by calling a static registerWith() that assigns the instance, exactly as package_info_plus does:
static void registerWith() {
PackageInfoPlatform.instance = PackageInfoPlusLinuxPlugin();
}
If _smartTextFlutter has already captured the default, that assignment does nothing and the Windows, Linux or web implementation is silently ignored.
Fix: read SmartTextFlutterPlatform.instance per call rather than caching it.
Found during the v0.4.0 codebase audit.
This captures the platform instance once, at class load. Any later assignment to
SmartTextFlutterPlatform.instancehas no effect.That defeats the override point
plugin_platform_interfaceexists to provide, and it is why the plugin is awkward to fake in tests.It also blocks desktop and web support. Flutter registers Dart-only platform implementations by calling a static
registerWith()that assigns the instance, exactly aspackage_info_plusdoes:If
_smartTextFlutterhas already captured the default, that assignment does nothing and the Windows, Linux or web implementation is silently ignored.Fix: read
SmartTextFlutterPlatform.instanceper call rather than caching it.Found during the v0.4.0 codebase audit.