- Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
area-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.
Description
Linter false positive: specify_nonobvious_property_types
triggers on Offset.zero
Description
The linter rule specify_nonobvious_property_types
incorrectly flags Offset.zero
as needing a type annotation, even though the type is unambiguous and self-explanatory.
Code Sample
class DemoWidget extends StatefulWidget { const DemoWidget({ super.key, }); @override State<DemoWidget> createState() => _DemoWidgetState(); } class _DemoWidgetState extends State<DemoWidget> with TickerProviderStateMixin { late AnimationController _controller; var _delta = Offset.zero; @override Widget build(BuildContext context) { return GestureDetector( behavior: HitTestBehavior.opaque, onTap: _onTap, child: Transform.translate(offset: _delta, child: const Text('huh?')), ); } void _onTap() => _delta = const Offset(42, 42); @override void dispose() { _controller.dispose(); super.dispose(); }

Expected Behavior
No warning should be produced. The type is Offset, which is clear from context.
Actual Behavior
Linter produces a warning:
A type annotation is needed because it isn’t obvious.
dart --version Dart SDK version: 3.8.1 (stable) (Wed May 28 00:47:25 2025 -0700) on "macos_arm64"
Please add devexp-linter
label.
Metadata
Metadata
Assignees
Labels
area-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.