diff --git a/analysis_options.yaml b/analysis_options.yaml index b590706..2feb8f3 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -92,6 +92,7 @@ linter: - no_leading_underscores_for_local_identifiers - no_logic_in_create_state - no_runtimeType_toString + - no_wildcard_variable_uses - non_constant_identifier_names - noop_primitive_operations - null_check_on_nullable_type_parameter @@ -153,6 +154,7 @@ linter: - tighten_type_of_initializing_formals - type_annotate_public_apis - type_init_formals + - type_literal_in_constant_pattern - unawaited_futures - unnecessary_await_in_return - unnecessary_brace_in_string_interps diff --git a/packages/mocktail/lib/src/mocktail.dart b/packages/mocktail/lib/src/mocktail.dart index bdc7a60..7173aca 100644 --- a/packages/mocktail/lib/src/mocktail.dart +++ b/packages/mocktail/lib/src/mocktail.dart @@ -206,11 +206,11 @@ When Function(T Function() x) get when { throw StateError('Cannot call `when` within a stub response'); } _whenInProgress = true; - return (T Function() _) { + return (T Function() fn) { try { - _(); - } catch (_) { - if (_ is! TypeError) rethrow; + fn(); + } catch (e) { + if (e is! TypeError) rethrow; } _whenInProgress = false; return When(); @@ -395,12 +395,12 @@ List Function( throw StateError(_verifyCalls.join()); } _verificationInProgress = true; - return (List _) { - for (final invocation in _) { + return (List invocations) { + for (final invocation in invocations) { try { invocation(); - } catch (_) { - if (_ is! TypeError) rethrow; + } catch (e) { + if (e is! TypeError) rethrow; } } @@ -503,11 +503,11 @@ Verify _makeVerify(bool never) { ); } _verificationInProgress = true; - return (T Function() mock) { + return (T Function() fn) { try { - mock(); - } catch (_) { - if (_ is! TypeError) rethrow; + fn(); + } catch (e) { + if (e is! TypeError) rethrow; } _verificationInProgress = false; if (_verifyCalls.length == 1) { @@ -758,11 +758,11 @@ class _VerifyCall { /// future will return immediately. Future Function(T Function() _) get untilCalled { _untilCalledInProgress = true; - return (T Function() _) { + return (T Function() fn) { try { - _(); - } catch (_) { - if (_ is! TypeError) rethrow; + fn(); + } catch (e) { + if (e is! TypeError) rethrow; } _untilCalledInProgress = false; return _untilCall!.invocationFuture;