throws_plugin 1.0.0-alpha
throws_plugin: ^1.0.0-alpha copied to clipboard
Analyzer plugin for @Throws/@throws usage.
throws_plugin #
Analyzer plugin for @Throws/@throws usage.
Install #
Add the plugin dependency to your pubspec.yaml and enable it in analysis_options.yaml.
analysis_options.yaml:
analyzer:
plugins:
- throws_plugin
Lints #
- missing_throws_annotation: functions that throw must be annotated with @Throws/@throws
- unhandled_throws_call: calls to throwing functions must be handled or annotated
- unused_throws_annotation: @Throws on functions that do not throw
Diagnostics are reported at the call site for unhandled throws.
Assists #
- Add
@Throwsannotation - Remove
@Throwsannotation - Wrap in
try/catch(with inferred expectedErrors when available)
throws.yaml #
Place throws.yaml at the package root to extend or override known throwing members.
throws:
useSdkMap: true
map:
dart:core.Iterable.single:
- StateError
If useSdkMap is false, only entries from throws.yaml are used.