resourceErased property

Future<Object?> Function() get resourceErased

resource, viewed untyped as Future<Object?> Function().

Contravariance in Dart Pattern Matching

When pattern matching against case SuspenseNode(): in mount or render code, Dart binds the generic type T as dynamic. Accessing builder through an erased reference would cast it to BloomNode Function(dynamic), which fails at runtime because Dart function parameters are contravariant: a BloomNode Function(UserData) is not a subtype of BloomNode Function(dynamic).

This getter performs the cast (data as T) internally within SuspenseNode where T is statically known, returning a closure that backend engines can safely call without type errors.

Implementation

Future<Object?> Function() get resourceErased => resource;