Open
Description
There are no options to import the extension method when writing specific code.
Steps to reproduce
object_extensions.dart
extension NullableObjectExtension on Object? {
Map<String, dynamic> asJson() => (this as Map).cast<String, dynamic>();
}
snippet.dart
typedef ObjectFactory<T> = T Function(Object? v);
class Rep<T> {
const Rep(this.data);
factory Rep.fromJson(
Map<String, Object?> json,
ObjectFactory<T> factory,
) {
return Rep<T>(factory(json));
}
final T data;
}
void test() {
final map = <String, Object?>{};
final rep = Rep.fromJson(map, (v) => v.asJson()); // <-- unchecked_use_of_nullable_value
}
Version
Dart SDK version: 3.8.1 (stable) (Wed May 28 00:47:25 2025 -0700) on "windows_x64"