PlatformViewGuard class
Guards platform-view creation during app startup / hot-restart.
On iOS, FlutterPlatformViewsController may retain residual view
registrations from a previous Dart isolate immediately after a hot
restart. If the new isolate's widgets request platform-view
creation before the engine has purged the stale registrations, it
rejects them with PlatformException(recreating_view, ...).
This guard delays platform-view widgets by 500 ms in debug mode
only — release builds (cold start, no isolate-recycling) flip
readiness to true immediately so the native iOS 26 widgets render
from the very first frame and no Flutter fallback is briefly shown
(Issue #41).
Usage inside component build methods:
if (!PlatformViewGuard.isReady) {
PlatformViewGuard.ensureScheduled();
return _fallbackWidget();
}
return UiKitView(...);
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- isReady → bool
-
Whether it is safe to create platform views.
no setter
-
readyNotifier
→ ValueNotifier<
bool> -
Notifier that fires once when readiness flips to
true.final
Static Methods
-
ensureScheduled(
) → void - Schedules the readiness flip if it hasn't been scheduled yet. No-op in release mode (already ready). In debug mode, waits 500 ms to let the engine finish purging stale platform-view registrations from a previous Dart isolate after a hot restart.