[analysis_options] sync lint rules with flutter/flutter (#2495)
diff --git a/analysis_options.yaml b/analysis_options.yaml
index a6b55d7..faa1b8b 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -1,35 +1,27 @@
# Specify analysis options.
#
-# Until there are meta linter rules, each desired lint must be explicitly enabled.
-# See: https://github.com/dart-lang/linter/issues/288
-#
-# For a list of lints, see: http://dart-lang.github.io/linter/lints/
-# See the configuration guide for more
-# https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer
-#
-# This file is derived from the master file in the flutter repo, and should be
-# kept in sync with it.
+# This file is a copy of analysis_options.yaml from flutter repo
+# as of 2022-07-27, but with some modifications marked with
+# "DIFFERENT FROM FLUTTER/FLUTTER" below. The file is expected to
+# be kept in sync with the master file from the flutter repo.
analyzer:
- strong-mode:
- implicit-dynamic: false
+ language:
+ strict-casts: false # DIFFERENT FROM FLUTTER/FLUTTER, too many violations, TODO(goderbauer): Clean this up.
+ strict-raw-types: true
errors:
- # treat missing required parameters as a warning (not a hint)
- missing_required_param: warning
- # treat missing returns as a warning (not a hint)
- missing_return: warning
- # allow having TODOs in the code
- todo: ignore
+ # allow self-reference to deprecated members (we do this because otherwise we have
+ # to annotate every member in every test, assert, etc, when we deprecate something)
+ deprecated_member_use_from_same_package: ignore
# Turned off until null-safe rollout is complete.
unnecessary_null_comparison: ignore
- exclude:
+ exclude: # DIFFERENT FROM FLUTTER/FLUTTER
# Ignore generated files
- '**/*.mocks.dart' # Mockito @GenerateMocks
linter:
rules:
- # these rules are documented on and in the same order as
- # the Dart Lint rules page to make maintenance easier
+ # This list is derived from the list of all available lints located at
# https://github.com/dart-lang/linter/blob/master/example/all.yaml
- always_declare_return_types
- always_put_control_body_on_new_line
@@ -40,32 +32,34 @@
- annotate_overrides
# - avoid_annotating_with_dynamic # conflicts with always_specify_types
- avoid_bool_literals_in_conditional_expressions
- # - avoid_catches_without_on_clauses # we do this commonly
- # - avoid_catching_errors # we do this commonly
+ # - avoid_catches_without_on_clauses # blocked on https://github.com/dart-lang/linter/issues/3023
+ # - avoid_catching_errors # blocked on https://github.com/dart-lang/linter/issues/3023
- avoid_classes_with_only_static_members
- # - avoid_double_and_int_checks # only useful when targeting JS runtime
- # - avoid_dynamic_calls # not yet tested
+ - avoid_double_and_int_checks
+ - avoid_dynamic_calls
- avoid_empty_else
- avoid_equals_and_hash_code_on_mutable_classes
- # - avoid_escaping_inner_quotes # not yet tested
+ - avoid_escaping_inner_quotes
- avoid_field_initializers_in_const_classes
+ # - avoid_final_parameters # incompatible with prefer_final_parameters
- avoid_function_literals_in_foreach_calls
- # - avoid_implementing_value_types # not yet tested
+ - avoid_implementing_value_types
- avoid_init_to_null
- # - avoid_js_rounded_ints # only useful when targeting JS runtime
+ - avoid_js_rounded_ints
+ # - avoid_multiple_declarations_per_line # seems to be a stylistic choice we don't subscribe to
- avoid_null_checks_in_equality_operators
- # - avoid_positional_boolean_parameters # not yet tested
- # - avoid_print # not yet tested
+ # - avoid_positional_boolean_parameters # would have been nice to enable this but by now there's too many places that break it
+ - avoid_print
# - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
- # - avoid_redundant_argument_values # not yet tested
+ - avoid_redundant_argument_values
- avoid_relative_lib_imports
- avoid_renaming_method_parameters
- avoid_return_types_on_setters
- # - avoid_returning_null # there are plenty of valid reasons to return null
- # - avoid_returning_null_for_future # not yet tested
+ - avoid_returning_null
+ - avoid_returning_null_for_future
- avoid_returning_null_for_void
- # - avoid_returning_this # there are plenty of valid reasons to return this
- # - avoid_setters_without_getters # not yet tested
+ # - avoid_returning_this # there are enough valid reasons to return `this` that this lint ends up with too many false positives
+ - avoid_setters_without_getters
- avoid_shadowing_type_parameters
- avoid_single_cascade_in_expression_statements
- avoid_slow_async_io
@@ -75,51 +69,59 @@
- avoid_unnecessary_containers
- avoid_unused_constructor_parameters
- avoid_void_async
- # - avoid_web_libraries_in_flutter # not yet tested
+ # - avoid_web_libraries_in_flutter # we use web libraries in web-specific code, and our tests prevent us from using them elsewhere
- await_only_futures
- camel_case_extensions
- camel_case_types
- cancel_subscriptions
- # - cascade_invocations # not yet tested
+ # - cascade_invocations # doesn't match the typical style of this repo
- cast_nullable_to_non_nullable
# - close_sinks # not reliable enough
+ - combinators_ordering
# - comment_references # blocked on https://github.com/dart-lang/linter/issues/1142
+ - conditional_uri_does_not_exist
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
- control_flow_in_finally
- # - curly_braces_in_flow_control_structures # not required by flutter style
+ - curly_braces_in_flow_control_structures
+ - depend_on_referenced_packages
- deprecated_consistency
- # - diagnostic_describe_all_properties # not yet tested
+ # - diagnostic_describe_all_properties # enabled only at the framework level (packages/flutter/lib)
- directives_ordering
- # - do_not_use_environment # we do this commonly
+ # - discarded_futures # not yet tested
+ # - do_not_use_environment # there are appropriate times to use the environment, especially in our tests and build logic
- empty_catches
- empty_constructor_bodies
- empty_statements
+ - eol_at_end_of_file
- exhaustive_cases
- file_names
- flutter_style_todos
- hash_and_equals
- implementation_imports
- # - invariant_booleans # too many false positives: https://github.com/dart-lang/linter/issues/811
- iterable_contains_unrelated_type
# - join_return_with_assignment # not required by flutter style
- leading_newlines_in_multiline_strings
- library_names
- library_prefixes
+ - library_private_types_in_public_api
# - lines_longer_than_80_chars # not required by flutter style
- list_remove_unrelated_type
- # - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181
+ # - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/linter/issues/453
- missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list
- # - no_default_cases # too many false positives
+ - no_default_cases
- no_duplicate_case_values
+ - no_leading_underscores_for_library_prefixes
+ - no_leading_underscores_for_local_identifiers
- no_logic_in_create_state
# - no_runtimeType_toString # ok in tests; we enable this only in packages/
- non_constant_identifier_names
+ - noop_primitive_operations
- null_check_on_nullable_type_parameter
- null_closures
# - omit_local_variable_types # opposite of always_specify_types
# - one_member_abstracts # too many false positives
- # - only_throw_errors # https://github.com/flutter/flutter/issues/5792
+ - only_throw_errors # this does get disabled in a few places where we have legacy code that uses strings et al
- overridden_fields
- package_api_docs
- package_names
@@ -142,6 +144,7 @@
- prefer_final_fields
- prefer_final_in_for_each
- prefer_final_locals
+ # - prefer_final_parameters # we should enable this one day when it can be auto-fixed (https://github.com/dart-lang/linter/issues/3104), see also parameter_assignments
- prefer_for_elements_to_map_fromIterable
- prefer_foreach
- prefer_function_declarations_over_variables
@@ -151,68 +154,78 @@
- prefer_initializing_formals
- prefer_inlined_adds
# - prefer_int_literals # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#use-double-literals-for-double-constants
- # - prefer_interpolation_to_compose_strings # doesn't work with raw strings, see https://github.com/dart-lang/linter/issues/2490
+ - prefer_interpolation_to_compose_strings
- prefer_is_empty
- prefer_is_not_empty
- prefer_is_not_operator
- prefer_iterable_whereType
- # - prefer_mixin # https://github.com/dart-lang/language/issues/32
+ # - prefer_mixin # Has false positives, see https://github.com/dart-lang/linter/issues/3018
+ # - prefer_null_aware_method_calls # "call()" is confusing to people new to the language since it's not documented anywhere
- prefer_null_aware_operators
- # - prefer_relative_imports # incompatible with sub-package imports
+ - prefer_relative_imports
- prefer_single_quotes
- prefer_spread_collections
- prefer_typing_uninitialized_variables
- prefer_void_to_null
- provide_deprecation_message
- - public_member_api_docs
+ - public_member_api_docs # DIFFERENT FROM FLUTTER/FLUTTER
- recursive_getters
+ # - require_trailing_commas # blocked on https://github.com/dart-lang/sdk/issues/47441
+ - secure_pubspec_urls
- sized_box_for_whitespace
+ # - sized_box_shrink_expand # not yet tested
- slash_for_doc_comments
- # - sort_child_properties_last # not yet tested
+ - sort_child_properties_last
- sort_constructors_first
- # - sort_pub_dependencies
+ - sort_pub_dependencies # DIFFERENT FROM FLUTTER/FLUTTER: Flutter's use case for not sorting does not apply to this repository.
- sort_unnamed_constructors_first
- test_types_in_equals
- throw_in_finally
- tighten_type_of_initializing_formals
# - type_annotate_public_apis # subset of always_specify_types
- type_init_formals
- # - unawaited_futures # too many false positives
+ # - unawaited_futures # too many false positives, especially with the way AnimationController works
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_const
+ - unnecessary_constructor_name
# - unnecessary_final # conflicts with prefer_final_locals
- unnecessary_getters_setters
# - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
+ - unnecessary_late
- unnecessary_new
- unnecessary_null_aware_assignments
- # - unnecessary_null_checks # not yet tested
+ - unnecessary_null_aware_operator_on_extension_on_nullable
+ - unnecessary_null_checks
- unnecessary_null_in_if_null_operators
- unnecessary_nullable_for_final_variable_declarations
- unnecessary_overrides
- unnecessary_parenthesis
- # - unnecessary_raw_strings # not yet tested
+ # - unnecessary_raw_strings # what's "necessary" is a matter of opinion; consistency across strings can help readability more than this lint
- unnecessary_statements
- unnecessary_string_escapes
- unnecessary_string_interpolations
- unnecessary_this
+ - unnecessary_to_list_in_spreads
- unrelated_type_equality_checks
- # - unsafe_html # not yet tested
+ - unsafe_html
+ - use_build_context_synchronously
+ # - use_colored_box # not yet tested
+ # - use_decorated_box # not yet tested
+ # - use_enums # not yet tested
- use_full_hex_values_for_flutter_colors
- use_function_type_syntax_for_parameters
- # - use_if_null_to_convert_nulls_to_bools # not yet tested
+ - use_if_null_to_convert_nulls_to_bools
- use_is_even_rather_than_modulo
- use_key_in_widget_constructors
- use_late_for_private_fields_and_variables
- # - use_named_constants # not yet yested
+ - use_named_constants
- use_raw_strings
- use_rethrow_when_possible
- # - use_setters_to_change_properties # not yet tested
+ - use_setters_to_change_properties
# - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182
+ - use_super_parameters
+ - use_test_throws_matchers
# - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
- valid_regexps
- void_checks
- ### Local flutter/packages changes ###
- # Flutter has a specific use case for dependencies that are intentionally
- # not sorted, which doesn't apply to this repo.
- - sort_pub_dependencies
diff --git a/packages/adaptive_scaffold/example/lib/main.dart b/packages/adaptive_scaffold/example/lib/main.dart
index f68b668..3e15cb3 100644
--- a/packages/adaptive_scaffold/example/lib/main.dart
+++ b/packages/adaptive_scaffold/example/lib/main.dart
@@ -225,7 +225,6 @@
leading: ScaleTransition(
scale: _controller1, child: const _MediumComposeIcon()),
backgroundColor: const Color.fromARGB(0, 255, 255, 255),
- labelType: NavigationRailLabelType.none,
destinations: <NavigationRailDestination>[
slideInNavigationItem(
begin: -1,
@@ -288,7 +287,7 @@
padding: const EdgeInsets.fromLTRB(0, 32, 0, 0),
child: _ItemList(
selected: selected,
- items: allItems,
+ items: _allItems,
selectCard: selectCard),
)
: const _ExamplePage(),
@@ -304,7 +303,7 @@
outAnimation: AdaptiveScaffold.stayOnScreen,
key: const Key('sBody'),
builder: (_) => SafeArea(
- child: _DetailTile(item: allItems[selected ?? 0]),
+ child: _DetailTile(item: _allItems[selected ?? 0]),
),
)
},
@@ -451,6 +450,8 @@
}
}
+typedef _CardSelectedCallback = void Function(int?);
+
// ItemList creates the list of cards and the search bar.
class _ItemList extends StatelessWidget {
const _ItemList({
@@ -462,7 +463,7 @@
final List<_Item> items;
final int? selected;
- final Function selectCard;
+ final _CardSelectedCallback selectCard;
@override
Widget build(BuildContext context) {
@@ -535,7 +536,7 @@
final _Item item;
final _Email email;
final int? selected;
- final Function selectCard;
+ final _CardSelectedCallback selectCard;
@override
Widget build(BuildContext context) {
@@ -545,19 +546,19 @@
// than large screens.
// Small screens open a modal with the detail view while large screens
// simply show the details on the secondaryBody.
- selectCard(allItems.indexOf(item));
+ selectCard(_allItems.indexOf(item));
if (!Breakpoints.mediumAndUp.isActive(context)) {
Navigator.of(context).pushNamed(_ExtractRouteArguments.routeName,
arguments: _ScreenArguments(item: item, selectCard: selectCard));
} else {
- selectCard(allItems.indexOf(item));
+ selectCard(_allItems.indexOf(item));
}
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
decoration: BoxDecoration(
- color: selected == allItems.indexOf(item)
+ color: selected == _allItems.indexOf(item)
? const Color.fromARGB(255, 234, 222, 255)
: const Color.fromARGB(255, 243, 237, 247),
borderRadius: const BorderRadius.all(Radius.circular(10)),
@@ -863,7 +864,7 @@
required this.selectCard,
});
final _Item item;
- final Function selectCard;
+ final _CardSelectedCallback selectCard;
}
class _ExtractRouteArguments extends StatelessWidget {
@@ -888,7 +889,7 @@
}) : super(key: key);
final _Item item;
- final Function selectCard;
+ final _CardSelectedCallback selectCard;
@override
Widget build(BuildContext context) {
@@ -952,7 +953,7 @@
/// List of items, each representing a thread of emails which will populate
/// the different layouts.
-const List<_Item> allItems = <_Item>[
+const List<_Item> _allItems = <_Item>[
_Item(
title: 'Dinner Club',
emails: <_Email>[
diff --git a/packages/adaptive_scaffold/example/test/adaptive_layout_demo_test.dart b/packages/adaptive_scaffold/example/test/adaptive_layout_demo_test.dart
index 90e96d7..45230be 100644
--- a/packages/adaptive_scaffold/example/test/adaptive_layout_demo_test.dart
+++ b/packages/adaptive_scaffold/example/test/adaptive_layout_demo_test.dart
@@ -84,7 +84,7 @@
expect(tester.getBottomLeft(bn), const Offset(0, 800));
expect(tester.getBottomRight(bn), const Offset(400, 800));
expect(tester.getTopRight(body), const Offset(400, 0));
- expect(tester.getTopLeft(body), const Offset(0, 0));
+ expect(tester.getTopLeft(body), Offset.zero);
});
testWidgets('adaptive layout does not animate when animations off',
diff --git a/packages/adaptive_scaffold/lib/src/adaptive_scaffold.dart b/packages/adaptive_scaffold/lib/src/adaptive_scaffold.dart
index a2f4172..355740e 100644
--- a/packages/adaptive_scaffold/lib/src/adaptive_scaffold.dart
+++ b/packages/adaptive_scaffold/lib/src/adaptive_scaffold.dart
@@ -357,7 +357,6 @@
controller: ScrollController(),
shrinkWrap: true,
physics: const AlwaysScrollableScrollPhysics(),
- scrollDirection: Axis.vertical,
slivers: <Widget>[
SliverToBoxAdapter(
child: Padding(
diff --git a/packages/animations/CHANGELOG.md b/packages/animations/CHANGELOG.md
index 92411a7..9e379ce 100644
--- a/packages/animations/CHANGELOG.md
+++ b/packages/animations/CHANGELOG.md
@@ -1,6 +1,7 @@
-## NEXT
+## 2.0.4
* Updates text theme parameters to avoid deprecation issues.
+* Fixes lint warnings.
## 2.0.3
* Updates for non-nullable bindings.
diff --git a/packages/animations/example/lib/container_transition.dart b/packages/animations/example/lib/container_transition.dart
index 9362d42..3fabccb 100644
--- a/packages/animations/example/lib/container_transition.dart
+++ b/packages/animations/example/lib/container_transition.dart
@@ -44,7 +44,7 @@
const OpenContainerTransformDemo({Key? key}) : super(key: key);
@override
- _OpenContainerTransformDemoState createState() {
+ State<OpenContainerTransformDemo> createState() {
return _OpenContainerTransformDemoState();
}
}
@@ -54,10 +54,11 @@
ContainerTransitionType _transitionType = ContainerTransitionType.fade;
void _showMarkedAsDoneSnackbar(bool? isMarkedAsDone) {
- if (isMarkedAsDone ?? false)
+ if (isMarkedAsDone ?? false) {
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
content: Text('Marked as done!'),
));
+ }
}
void _showSettingsBottomModalSheet(BuildContext context) {
@@ -464,7 +465,6 @@
Widget build(BuildContext context) {
return SizedBox(
height: height,
- width: null,
child: InkWell(
onTap: openContainer,
child: child,
diff --git a/packages/animations/example/lib/fade_scale_transition.dart b/packages/animations/example/lib/fade_scale_transition.dart
index 26a2192..b6ca592 100644
--- a/packages/animations/example/lib/fade_scale_transition.dart
+++ b/packages/animations/example/lib/fade_scale_transition.dart
@@ -11,7 +11,7 @@
const FadeScaleTransitionDemo({Key? key}) : super(key: key);
@override
- _FadeScaleTransitionDemoState createState() =>
+ State<FadeScaleTransitionDemo> createState() =>
_FadeScaleTransitionDemoState();
}
diff --git a/packages/animations/example/lib/fade_through_transition.dart b/packages/animations/example/lib/fade_through_transition.dart
index 978af59..2cc1dde 100644
--- a/packages/animations/example/lib/fade_through_transition.dart
+++ b/packages/animations/example/lib/fade_through_transition.dart
@@ -11,7 +11,7 @@
const FadeThroughTransitionDemo({Key? key}) : super(key: key);
@override
- _FadeThroughTransitionDemoState createState() =>
+ State<FadeThroughTransitionDemo> createState() =>
_FadeThroughTransitionDemoState();
}
diff --git a/packages/animations/example/lib/shared_axis_transition.dart b/packages/animations/example/lib/shared_axis_transition.dart
index 8fd6d1d..eaf0f86 100644
--- a/packages/animations/example/lib/shared_axis_transition.dart
+++ b/packages/animations/example/lib/shared_axis_transition.dart
@@ -11,7 +11,7 @@
const SharedAxisTransitionDemo({Key? key}) : super(key: key);
@override
- _SharedAxisTransitionDemoState createState() {
+ State<SharedAxisTransitionDemo> createState() {
return _SharedAxisTransitionDemoState();
}
}
@@ -43,7 +43,6 @@
children: <Widget>[
Expanded(
child: PageTransitionSwitcher(
- duration: const Duration(milliseconds: 300),
reverse: !_isLoggedIn,
transitionBuilder: (
Widget child,
@@ -51,10 +50,10 @@
Animation<double> secondaryAnimation,
) {
return SharedAxisTransition(
- child: child,
animation: animation,
secondaryAnimation: secondaryAnimation,
transitionType: _transitionType!,
+ child: child,
);
},
child: _isLoggedIn ? _CoursePage() : _SignInPage(),
diff --git a/packages/animations/lib/src/fade_through_transition.dart b/packages/animations/lib/src/fade_through_transition.dart
index 2d1b629..1b79628 100644
--- a/packages/animations/lib/src/fade_through_transition.dart
+++ b/packages/animations/lib/src/fade_through_transition.dart
@@ -239,8 +239,8 @@
Widget? child,
) {
return _FadeOut(
- child: child,
animation: animation,
+ child: child,
);
},
child: child,
diff --git a/packages/animations/lib/src/modal.dart b/packages/animations/lib/src/modal.dart
index 52da6e1..73047d5 100644
--- a/packages/animations/lib/src/modal.dart
+++ b/packages/animations/lib/src/modal.dart
@@ -131,6 +131,8 @@
) {
final ThemeData theme = Theme.of(context);
return Semantics(
+ scopesRoute: true,
+ explicitChildNodes: true,
child: SafeArea(
child: Builder(
builder: (BuildContext context) {
@@ -139,8 +141,6 @@
},
),
),
- scopesRoute: true,
- explicitChildNodes: true,
);
}
diff --git a/packages/animations/lib/src/open_container.dart b/packages/animations/lib/src/open_container.dart
index a3a3c72..14c862e 100644
--- a/packages/animations/lib/src/open_container.dart
+++ b/packages/animations/lib/src/open_container.dart
@@ -261,7 +261,7 @@
final Clip clipBehavior;
@override
- _OpenContainerState<T> createState() => _OpenContainerState<T>();
+ State<OpenContainer<T?>> createState() => _OpenContainerState<T>();
}
class _OpenContainerState<T> extends State<OpenContainer<T?>> {
diff --git a/packages/animations/lib/src/page_transition_switcher.dart b/packages/animations/lib/src/page_transition_switcher.dart
index 32bab71..9770b05 100644
--- a/packages/animations/lib/src/page_transition_switcher.dart
+++ b/packages/animations/lib/src/page_transition_switcher.dart
@@ -265,13 +265,13 @@
/// signature.
static Widget defaultLayoutBuilder(List<Widget> entries) {
return Stack(
- children: entries,
alignment: Alignment.center,
+ children: entries,
);
}
@override
- _PageTransitionSwitcherState createState() => _PageTransitionSwitcherState();
+ State<PageTransitionSwitcher> createState() => _PageTransitionSwitcherState();
}
class _PageTransitionSwitcherState extends State<PageTransitionSwitcher>
diff --git a/packages/animations/pubspec.yaml b/packages/animations/pubspec.yaml
index 56a4bea..e320601 100644
--- a/packages/animations/pubspec.yaml
+++ b/packages/animations/pubspec.yaml
@@ -2,7 +2,7 @@
description: Fancy pre-built animations that can easily be integrated into any Flutter application.
repository: https://github.com/flutter/packages/tree/main/packages/animations
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+animations%22
-version: 2.0.3
+version: 2.0.4
environment:
sdk: '>=2.12.0 <3.0.0'
diff --git a/packages/animations/test/fade_scale_transition_test.dart b/packages/animations/test/fade_scale_transition_test.dart
index 4fdc668..c38b306 100644
--- a/packages/animations/test/fade_scale_transition_test.dart
+++ b/packages/animations/test/fade_scale_transition_test.dart
@@ -20,7 +20,6 @@
onPressed: () {
showModal<void>(
context: context,
- configuration: const FadeScaleTransitionConfiguration(),
builder: (BuildContext context) {
return const _FlutterLogoModal();
},
@@ -52,7 +51,6 @@
onPressed: () {
showModal<void>(
context: context,
- configuration: const FadeScaleTransitionConfiguration(),
builder: (BuildContext context) {
return _FlutterLogoModal(key: key);
},
@@ -120,7 +118,6 @@
onPressed: () {
showModal<void>(
context: context,
- configuration: const FadeScaleTransitionConfiguration(),
builder: (BuildContext context) {
return _FlutterLogoModal(key: key);
},
@@ -185,7 +182,6 @@
onPressed: () {
showModal<void>(
context: context,
- configuration: const FadeScaleTransitionConfiguration(),
builder: (BuildContext context) {
return _FlutterLogoModal(key: key);
},
@@ -286,8 +282,6 @@
onPressed: () {
showModal<void>(
context: context,
- configuration:
- const FadeScaleTransitionConfiguration(),
builder: (BuildContext context) {
return _FlutterLogoModal(
key: topKey,
diff --git a/packages/animations/test/fade_through_transition_test.dart b/packages/animations/test/fade_through_transition_test.dart
index fff378b..7d8a5fa 100644
--- a/packages/animations/test/fade_through_transition_test.dart
+++ b/packages/animations/test/fade_through_transition_test.dart
@@ -376,9 +376,9 @@
textDirection: TextDirection.ltr,
child: Center(
child: FadeThroughTransition(
- child: const _StatefulTestWidget(name: 'Foo'),
animation: animation,
secondaryAnimation: secondaryAnimation,
+ child: const _StatefulTestWidget(name: 'Foo'),
),
),
));
diff --git a/packages/animations/test/open_container_test.dart b/packages/animations/test/open_container_test.dart
index 3c53c95..66fca5d 100644
--- a/packages/animations/test/open_container_test.dart
+++ b/packages/animations/test/open_container_test.dart
@@ -1622,7 +1622,7 @@
expect(material.clipBehavior, Clip.none);
});
- Widget _createRootNavigatorTest({
+ Widget createRootNavigatorTest({
required Key appKey,
required Key nestedNavigatorKey,
required bool useRootNavigator,
@@ -1670,7 +1670,7 @@
const Key appKey = Key('App');
const Key nestedNavigatorKey = Key('Nested Navigator');
- await tester.pumpWidget(_createRootNavigatorTest(
+ await tester.pumpWidget(createRootNavigatorTest(
appKey: appKey,
nestedNavigatorKey: nestedNavigatorKey,
useRootNavigator: false));
@@ -1693,7 +1693,7 @@
const Key appKey = Key('App');
const Key nestedNavigatorKey = Key('Nested Navigator');
- await tester.pumpWidget(_createRootNavigatorTest(
+ await tester.pumpWidget(createRootNavigatorTest(
appKey: appKey,
nestedNavigatorKey: nestedNavigatorKey,
useRootNavigator: true));
@@ -1716,7 +1716,7 @@
const Key appKey = Key('App');
const Key nestedNavigatorKey = Key('Nested Navigator');
- await tester.pumpWidget(_createRootNavigatorTest(
+ await tester.pumpWidget(createRootNavigatorTest(
appKey: appKey,
nestedNavigatorKey: nestedNavigatorKey,
useRootNavigator: false));
@@ -1733,7 +1733,7 @@
const Key appKey = Key('App');
const Key nestedNavigatorKey = Key('Nested Navigator');
- await tester.pumpWidget(_createRootNavigatorTest(
+ await tester.pumpWidget(createRootNavigatorTest(
appKey: appKey,
nestedNavigatorKey: nestedNavigatorKey,
useRootNavigator: true));
@@ -1786,7 +1786,7 @@
// Regression test for https://github.com/flutter/flutter/issues/72238.
testWidgets(
- 'OpenContainer\'s source widget is visible in closed container route if '
+ "OpenContainer's source widget is visible in closed container route if "
'open container route is pushed from not using the OpenContainer itself',
(WidgetTester tester) async {
final Widget openContainer = OpenContainer(
diff --git a/packages/animations/test/page_transition_switcher_test.dart b/packages/animations/test/page_transition_switcher_test.dart
index aa4904e..c40f4ca 100644
--- a/packages/animations/test/page_transition_switcher_test.dart
+++ b/packages/animations/test/page_transition_switcher_test.dart
@@ -14,37 +14,37 @@
await tester.pumpWidget(
PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: Container(key: containerOne, color: const Color(0x00000000)),
transitionBuilder: _transitionBuilder,
+ child: Container(key: containerOne, color: const Color(0x00000000)),
),
);
- Map<Key, double> _primaryAnimation =
+ Map<Key, double> primaryAnimation =
_getPrimaryAnimation(<Key>[containerOne], tester);
- Map<Key, double> _secondaryAnimation =
+ Map<Key, double> secondaryAnimation =
_getSecondaryAnimation(<Key>[containerOne], tester);
- expect(_primaryAnimation[containerOne], equals(1.0));
- expect(_secondaryAnimation[containerOne], equals(0.0));
+ expect(primaryAnimation[containerOne], equals(1.0));
+ expect(secondaryAnimation[containerOne], equals(0.0));
await tester.pumpWidget(
PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: Container(key: containerTwo, color: const Color(0xff000000)),
transitionBuilder: _transitionBuilder,
+ child: Container(key: containerTwo, color: const Color(0xff000000)),
),
);
await tester.pump(const Duration(milliseconds: 40));
- _primaryAnimation =
+ primaryAnimation =
_getPrimaryAnimation(<Key>[containerOne, containerTwo], tester);
- _secondaryAnimation =
+ secondaryAnimation =
_getSecondaryAnimation(<Key>[containerOne, containerTwo], tester);
// Secondary is running for outgoing widget.
- expect(_primaryAnimation[containerOne], equals(1.0));
- expect(_secondaryAnimation[containerOne], moreOrLessEquals(0.4));
+ expect(primaryAnimation[containerOne], equals(1.0));
+ expect(secondaryAnimation[containerOne], moreOrLessEquals(0.4));
// Primary is running for incoming widget.
- expect(_primaryAnimation[containerTwo], moreOrLessEquals(0.4));
- expect(_secondaryAnimation[containerTwo], equals(0.0));
+ expect(primaryAnimation[containerTwo], moreOrLessEquals(0.4));
+ expect(secondaryAnimation[containerTwo], equals(0.0));
// Container one is underneath container two
final Container container = tester.firstWidget(find.byType(Container));
@@ -53,22 +53,22 @@
await tester.pumpWidget(
PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: Container(key: containerThree, color: const Color(0xffff0000)),
transitionBuilder: _transitionBuilder,
+ child: Container(key: containerThree, color: const Color(0xffff0000)),
),
);
await tester.pump(const Duration(milliseconds: 20));
- _primaryAnimation = _getPrimaryAnimation(
+ primaryAnimation = _getPrimaryAnimation(
<Key>[containerOne, containerTwo, containerThree], tester);
- _secondaryAnimation = _getSecondaryAnimation(
+ secondaryAnimation = _getSecondaryAnimation(
<Key>[containerOne, containerTwo, containerThree], tester);
- expect(_primaryAnimation[containerOne], equals(1.0));
- expect(_secondaryAnimation[containerOne], equals(0.6));
- expect(_primaryAnimation[containerTwo], equals(0.6));
- expect(_secondaryAnimation[containerTwo], moreOrLessEquals(0.2));
- expect(_primaryAnimation[containerThree], moreOrLessEquals(0.2));
- expect(_secondaryAnimation[containerThree], equals(0.0));
+ expect(primaryAnimation[containerOne], equals(1.0));
+ expect(secondaryAnimation[containerOne], equals(0.6));
+ expect(primaryAnimation[containerTwo], equals(0.6));
+ expect(secondaryAnimation[containerTwo], moreOrLessEquals(0.2));
+ expect(primaryAnimation[containerThree], moreOrLessEquals(0.2));
+ expect(secondaryAnimation[containerThree], equals(0.0));
await tester.pumpAndSettle();
});
@@ -80,39 +80,39 @@
await tester.pumpWidget(
PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: Container(key: containerOne, color: const Color(0x00000000)),
transitionBuilder: _transitionBuilder,
reverse: true,
+ child: Container(key: containerOne, color: const Color(0x00000000)),
),
);
- Map<Key, double> _primaryAnimation =
+ Map<Key, double> primaryAnimation =
_getPrimaryAnimation(<Key>[containerOne], tester);
- Map<Key, double> _secondaryAnimation =
+ Map<Key, double> secondaryAnimation =
_getSecondaryAnimation(<Key>[containerOne], tester);
- expect(_primaryAnimation[containerOne], equals(1.0));
- expect(_secondaryAnimation[containerOne], equals(0.0));
+ expect(primaryAnimation[containerOne], equals(1.0));
+ expect(secondaryAnimation[containerOne], equals(0.0));
await tester.pumpWidget(
PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: Container(key: containerTwo, color: const Color(0xff000000)),
transitionBuilder: _transitionBuilder,
reverse: true,
+ child: Container(key: containerTwo, color: const Color(0xff000000)),
),
);
await tester.pump(const Duration(milliseconds: 40));
- _primaryAnimation =
+ primaryAnimation =
_getPrimaryAnimation(<Key>[containerOne, containerTwo], tester);
- _secondaryAnimation =
+ secondaryAnimation =
_getSecondaryAnimation(<Key>[containerOne, containerTwo], tester);
// Primary is running forward for outgoing widget.
- expect(_primaryAnimation[containerOne], moreOrLessEquals(0.6));
- expect(_secondaryAnimation[containerOne], equals(0.0));
+ expect(primaryAnimation[containerOne], moreOrLessEquals(0.6));
+ expect(secondaryAnimation[containerOne], equals(0.0));
// Secondary is running forward for incoming widget.
- expect(_primaryAnimation[containerTwo], equals(1.0));
- expect(_secondaryAnimation[containerTwo], moreOrLessEquals(0.6));
+ expect(primaryAnimation[containerTwo], equals(1.0));
+ expect(secondaryAnimation[containerTwo], moreOrLessEquals(0.6));
// Container two two is underneath container one.
final Container container = tester.firstWidget(find.byType(Container));
@@ -121,23 +121,23 @@
await tester.pumpWidget(
PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: Container(key: containerThree, color: const Color(0xffff0000)),
transitionBuilder: _transitionBuilder,
reverse: true,
+ child: Container(key: containerThree, color: const Color(0xffff0000)),
),
);
await tester.pump(const Duration(milliseconds: 20));
- _primaryAnimation = _getPrimaryAnimation(
+ primaryAnimation = _getPrimaryAnimation(
<Key>[containerOne, containerTwo, containerThree], tester);
- _secondaryAnimation = _getSecondaryAnimation(
+ secondaryAnimation = _getSecondaryAnimation(
<Key>[containerOne, containerTwo, containerThree], tester);
- expect(_primaryAnimation[containerOne], equals(0.4));
- expect(_secondaryAnimation[containerOne], equals(0.0));
- expect(_primaryAnimation[containerTwo], equals(0.8));
- expect(_secondaryAnimation[containerTwo], equals(0.4));
- expect(_primaryAnimation[containerThree], equals(1.0));
- expect(_secondaryAnimation[containerThree], equals(0.8));
+ expect(primaryAnimation[containerOne], equals(0.4));
+ expect(secondaryAnimation[containerOne], equals(0.0));
+ expect(primaryAnimation[containerTwo], equals(0.8));
+ expect(secondaryAnimation[containerTwo], equals(0.4));
+ expect(primaryAnimation[containerThree], equals(1.0));
+ expect(secondaryAnimation[containerThree], equals(0.8));
await tester.pumpAndSettle();
});
@@ -148,56 +148,56 @@
await tester.pumpWidget(
PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: Container(key: containerOne, color: const Color(0x00000000)),
transitionBuilder: _transitionBuilder,
+ child: Container(key: containerOne, color: const Color(0x00000000)),
),
);
- Map<Key, double> _primaryAnimation =
+ Map<Key, double> primaryAnimation =
_getPrimaryAnimation(<Key>[containerOne], tester);
- Map<Key, double> _secondaryAnimation =
+ Map<Key, double> secondaryAnimation =
_getSecondaryAnimation(<Key>[containerOne], tester);
- expect(_primaryAnimation[containerOne], equals(1.0));
- expect(_secondaryAnimation[containerOne], equals(0.0));
+ expect(primaryAnimation[containerOne], equals(1.0));
+ expect(secondaryAnimation[containerOne], equals(0.0));
await tester.pumpWidget(
PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: Container(key: containerTwo, color: const Color(0xff000000)),
transitionBuilder: _transitionBuilder,
+ child: Container(key: containerTwo, color: const Color(0xff000000)),
),
);
await tester.pump(const Duration(milliseconds: 40));
- _primaryAnimation =
+ primaryAnimation =
_getPrimaryAnimation(<Key>[containerOne, containerTwo], tester);
- _secondaryAnimation =
+ secondaryAnimation =
_getSecondaryAnimation(<Key>[containerOne, containerTwo], tester);
- expect(_secondaryAnimation[containerOne], moreOrLessEquals(0.4));
- expect(_primaryAnimation[containerOne], equals(1.0));
- expect(_secondaryAnimation[containerTwo], equals(0.0));
- expect(_primaryAnimation[containerTwo], moreOrLessEquals(0.4));
+ expect(secondaryAnimation[containerOne], moreOrLessEquals(0.4));
+ expect(primaryAnimation[containerOne], equals(1.0));
+ expect(secondaryAnimation[containerTwo], equals(0.0));
+ expect(primaryAnimation[containerTwo], moreOrLessEquals(0.4));
await tester.pumpWidget(
PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: Container(key: containerThree, color: const Color(0xffff0000)),
transitionBuilder: _transitionBuilder,
reverse: true,
+ child: Container(key: containerThree, color: const Color(0xffff0000)),
),
);
await tester.pump(const Duration(milliseconds: 20));
- _primaryAnimation = _getPrimaryAnimation(
+ primaryAnimation = _getPrimaryAnimation(
<Key>[containerOne, containerTwo, containerThree], tester);
- _secondaryAnimation = _getSecondaryAnimation(
+ secondaryAnimation = _getSecondaryAnimation(
<Key>[containerOne, containerTwo, containerThree], tester);
- expect(_secondaryAnimation[containerOne], equals(0.6));
- expect(_primaryAnimation[containerOne], equals(1.0));
- expect(_secondaryAnimation[containerTwo], equals(0.0));
- expect(_primaryAnimation[containerTwo], moreOrLessEquals(0.2));
- expect(_secondaryAnimation[containerThree], equals(0.8));
- expect(_primaryAnimation[containerThree], equals(1.0));
+ expect(secondaryAnimation[containerOne], equals(0.6));
+ expect(primaryAnimation[containerOne], equals(1.0));
+ expect(secondaryAnimation[containerTwo], equals(0.0));
+ expect(primaryAnimation[containerTwo], moreOrLessEquals(0.2));
+ expect(secondaryAnimation[containerThree], equals(0.8));
+ expect(primaryAnimation[containerThree], equals(1.0));
await tester.pumpAndSettle();
});
@@ -208,39 +208,39 @@
await tester.pumpWidget(
PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: Container(key: containerOne, color: const Color(0x00000000)),
transitionBuilder: _transitionBuilder,
reverse: true,
+ child: Container(key: containerOne, color: const Color(0x00000000)),
),
);
- Map<Key, double> _primaryAnimation =
+ Map<Key, double> primaryAnimation =
_getPrimaryAnimation(<Key>[containerOne], tester);
- Map<Key, double> _secondaryAnimation =
+ Map<Key, double> secondaryAnimation =
_getSecondaryAnimation(<Key>[containerOne], tester);
- expect(_primaryAnimation[containerOne], equals(1.0));
- expect(_secondaryAnimation[containerOne], equals(0.0));
+ expect(primaryAnimation[containerOne], equals(1.0));
+ expect(secondaryAnimation[containerOne], equals(0.0));
await tester.pumpWidget(
PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: Container(key: containerTwo, color: const Color(0xff000000)),
transitionBuilder: _transitionBuilder,
reverse: true,
+ child: Container(key: containerTwo, color: const Color(0xff000000)),
),
);
await tester.pump(const Duration(milliseconds: 40));
- _primaryAnimation =
+ primaryAnimation =
_getPrimaryAnimation(<Key>[containerOne, containerTwo], tester);
- _secondaryAnimation =
+ secondaryAnimation =
_getSecondaryAnimation(<Key>[containerOne, containerTwo], tester);
// Primary is running in reverse for outgoing widget.
- expect(_primaryAnimation[containerOne], moreOrLessEquals(0.6));
- expect(_secondaryAnimation[containerOne], equals(0.0));
+ expect(primaryAnimation[containerOne], moreOrLessEquals(0.6));
+ expect(secondaryAnimation[containerOne], equals(0.0));
// Secondary is running in reverse for incoming widget.
- expect(_primaryAnimation[containerTwo], equals(1.0));
- expect(_secondaryAnimation[containerTwo], moreOrLessEquals(0.6));
+ expect(primaryAnimation[containerTwo], equals(1.0));
+ expect(secondaryAnimation[containerTwo], moreOrLessEquals(0.6));
// Container two is underneath container one.
final Container container = tester.firstWidget(find.byType(Container));
@@ -249,9 +249,8 @@
await tester.pumpWidget(
PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: Container(key: containerThree, color: const Color(0xffff0000)),
transitionBuilder: _transitionBuilder,
- reverse: false,
+ child: Container(key: containerThree, color: const Color(0xffff0000)),
),
);
await tester.pump(const Duration(milliseconds: 20));
@@ -262,16 +261,16 @@
// it should now be exiting underneath container three. Container three's
// primary animation should be running forwards since it is entering above
// container two.
- _primaryAnimation = _getPrimaryAnimation(
+ primaryAnimation = _getPrimaryAnimation(
<Key>[containerOne, containerTwo, containerThree], tester);
- _secondaryAnimation = _getSecondaryAnimation(
+ secondaryAnimation = _getSecondaryAnimation(
<Key>[containerOne, containerTwo, containerThree], tester);
- expect(_primaryAnimation[containerOne], equals(0.4));
- expect(_secondaryAnimation[containerOne], equals(0.0));
- expect(_primaryAnimation[containerTwo], equals(1.0));
- expect(_secondaryAnimation[containerTwo], equals(0.8));
- expect(_primaryAnimation[containerThree], moreOrLessEquals(0.2));
- expect(_secondaryAnimation[containerThree], equals(0.0));
+ expect(primaryAnimation[containerOne], equals(0.4));
+ expect(secondaryAnimation[containerOne], equals(0.0));
+ expect(primaryAnimation[containerTwo], equals(1.0));
+ expect(secondaryAnimation[containerTwo], equals(0.8));
+ expect(primaryAnimation[containerThree], moreOrLessEquals(0.2));
+ expect(secondaryAnimation[containerThree], equals(0.0));
await tester.pumpAndSettle();
});
@@ -285,9 +284,9 @@
await tester.pumpWidget(
PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: Container(color: const Color(0x00000000)),
transitionBuilder: _transitionBuilder,
layoutBuilder: newLayoutBuilder,
+ child: Container(color: const Color(0x00000000)),
),
);
@@ -299,8 +298,8 @@
await tester.pumpWidget(
PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: Container(color: const Color(0x00000000)),
transitionBuilder: _transitionBuilder,
+ child: Container(color: const Color(0x00000000)),
),
);
@@ -314,8 +313,8 @@
await tester.pumpWidget(
PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: Container(color: const Color(0xff000000)),
transitionBuilder: _transitionBuilder,
+ child: Container(color: const Color(0xff000000)),
),
);
@@ -333,7 +332,6 @@
await tester.pumpWidget(
const PageTransitionSwitcher(
duration: Duration(milliseconds: 100),
- child: null,
transitionBuilder: _transitionBuilder,
),
);
@@ -344,8 +342,8 @@
await tester.pumpWidget(
PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: Container(color: const Color(0xff000000)),
transitionBuilder: _transitionBuilder,
+ child: Container(color: const Color(0xff000000)),
),
);
@@ -361,7 +359,6 @@
await tester.pumpWidget(
const PageTransitionSwitcher(
duration: Duration(milliseconds: 100),
- child: null,
transitionBuilder: _transitionBuilder,
),
);
@@ -381,16 +378,16 @@
await tester.pumpWidget(
PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: Container(key: UniqueKey(), color: const Color(0xff000000)),
transitionBuilder: _transitionBuilder,
+ child: Container(key: UniqueKey(), color: const Color(0xff000000)),
),
);
await tester.pumpWidget(
PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: Container(key: UniqueKey(), color: const Color(0xff000000)),
transitionBuilder: _transitionBuilder,
+ child: Container(key: UniqueKey(), color: const Color(0xff000000)),
),
);
await tester.pump(const Duration(milliseconds: 50));
@@ -405,8 +402,7 @@
// Change the widget tree in the middle of the animation.
await tester.pumpWidget(Container(color: const Color(0xffff0000)));
- expect(await tester.pumpAndSettle(const Duration(milliseconds: 100)),
- equals(1));
+ expect(await tester.pumpAndSettle(), equals(1));
});
testWidgets("doesn't reset state of the children in transitions.",
@@ -420,42 +416,42 @@
await tester.pumpWidget(
PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: StatefulTestWidget(key: statefulOne),
transitionBuilder: _transitionBuilder,
+ child: StatefulTestWidget(key: statefulOne),
),
);
- Map<Key, double> _primaryAnimation =
+ Map<Key, double> primaryAnimation =
_getPrimaryAnimation(<Key>[statefulOne], tester);
- Map<Key, double> _secondaryAnimation =
+ Map<Key, double> secondaryAnimation =
_getSecondaryAnimation(<Key>[statefulOne], tester);
- expect(_primaryAnimation[statefulOne], equals(1.0));
- expect(_secondaryAnimation[statefulOne], equals(0.0));
+ expect(primaryAnimation[statefulOne], equals(1.0));
+ expect(secondaryAnimation[statefulOne], equals(0.0));
expect(StatefulTestWidgetState.generation, equals(1));
await tester.pumpWidget(
PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: StatefulTestWidget(key: statefulTwo),
transitionBuilder: _transitionBuilder,
+ child: StatefulTestWidget(key: statefulTwo),
),
);
await tester.pump(const Duration(milliseconds: 50));
expect(find.byType(FadeTransition), findsNWidgets(2));
- _primaryAnimation =
+ primaryAnimation =
_getPrimaryAnimation(<Key>[statefulOne, statefulTwo], tester);
- _secondaryAnimation =
+ secondaryAnimation =
_getSecondaryAnimation(<Key>[statefulOne, statefulTwo], tester);
- expect(_primaryAnimation[statefulTwo], equals(0.5));
- expect(_secondaryAnimation[statefulTwo], equals(0.0));
+ expect(primaryAnimation[statefulTwo], equals(0.5));
+ expect(secondaryAnimation[statefulTwo], equals(0.0));
expect(StatefulTestWidgetState.generation, equals(2));
await tester.pumpWidget(
PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: StatefulTestWidget(key: statefulThree),
transitionBuilder: _transitionBuilder,
+ child: StatefulTestWidget(key: statefulThree),
),
);
@@ -473,8 +469,8 @@
textDirection: TextDirection.rtl,
child: PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: child,
transitionBuilder: _transitionBuilder,
+ child: child,
),
),
);
@@ -511,8 +507,8 @@
textDirection: TextDirection.ltr,
child: PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
+ transitionBuilder: _transitionBuilder,
child: Container(key: containerOne, color: const Color(0xFFFF0000)),
- transitionBuilder: _transitionBuilder,
),
),
);
@@ -524,8 +520,8 @@
textDirection: TextDirection.ltr,
child: PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
+ transitionBuilder: _transitionBuilder,
child: Container(key: containerTwo, color: const Color(0xFF00FF00)),
- transitionBuilder: _transitionBuilder,
),
),
);
@@ -537,8 +533,8 @@
textDirection: TextDirection.ltr,
child: PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: Container(key: containerThree, color: const Color(0xFF0000FF)),
transitionBuilder: _transitionBuilder,
+ child: Container(key: containerThree, color: const Color(0xFF0000FF)),
),
),
);
@@ -569,8 +565,8 @@
textDirection: TextDirection.ltr,
child: PageTransitionSwitcher(
duration: const Duration(milliseconds: 100),
- child: Container(key: containerThree, color: const Color(0x00000000)),
transitionBuilder: newTransitionBuilder,
+ child: Container(key: containerThree, color: const Color(0x00000000)),
),
),
);
diff --git a/packages/animations/test/shared_axis_transition_test.dart b/packages/animations/test/shared_axis_transition_test.dart
index b91ba7f..92fd7fc 100644
--- a/packages/animations/test/shared_axis_transition_test.dart
+++ b/packages/animations/test/shared_axis_transition_test.dart
@@ -596,9 +596,9 @@
child: Center(
child: SharedAxisTransition(
transitionType: SharedAxisTransitionType.horizontal,
- child: const _StatefulTestWidget(name: 'Foo'),
animation: animation,
secondaryAnimation: secondaryAnimation,
+ child: const _StatefulTestWidget(name: 'Foo'),
),
),
));
@@ -1239,9 +1239,9 @@
child: Center(
child: SharedAxisTransition(
transitionType: SharedAxisTransitionType.vertical,
- child: const _StatefulTestWidget(name: 'Foo'),
animation: animation,
secondaryAnimation: secondaryAnimation,
+ child: const _StatefulTestWidget(name: 'Foo'),
),
),
));
@@ -1775,9 +1775,9 @@
child: Center(
child: SharedAxisTransition(
transitionType: SharedAxisTransitionType.scaled,
- child: const _StatefulTestWidget(name: 'Foo'),
animation: animation,
secondaryAnimation: secondaryAnimation,
+ child: const _StatefulTestWidget(name: 'Foo'),
),
),
));
diff --git a/packages/cross_file/CHANGELOG.md b/packages/cross_file/CHANGELOG.md
index 03ef524..b462e36 100644
--- a/packages/cross_file/CHANGELOG.md
+++ b/packages/cross_file/CHANGELOG.md
@@ -1,3 +1,7 @@
+## NEXT
+
+* Fixes lint warnings in tests.
+
## 0.3.3+1
* Fixes `lastModified` unimplemented error description.
diff --git a/packages/cross_file/test/x_file_io_test.dart b/packages/cross_file/test/x_file_io_test.dart
index fd7c9a6..cb762cb 100644
--- a/packages/cross_file/test/x_file_io_test.dart
+++ b/packages/cross_file/test/x_file_io_test.dart
@@ -13,7 +13,7 @@
final String pathPrefix =
Directory.current.path.endsWith('test') ? './assets/' : './test/assets/';
-final String path = pathPrefix + 'hello.txt';
+final String path = '${pathPrefix}hello.txt';
const String expectedStringContents = 'Hello, world!';
final Uint8List bytes = Uint8List.fromList(utf8.encode(expectedStringContents));
final File textFile = File(path);
diff --git a/packages/dynamic_layouts/lib/src/dynamic_grid.dart b/packages/dynamic_layouts/lib/src/dynamic_grid.dart
index 7152ee7..9649a3f 100644
--- a/packages/dynamic_layouts/lib/src/dynamic_grid.dart
+++ b/packages/dynamic_layouts/lib/src/dynamic_grid.dart
@@ -29,9 +29,9 @@
super.key,
required super.gridDelegate,
// This creates a SliverChildBuilderDelegate in the super class.
- required IndexedWidgetBuilder itemBuilder,
+ required super.itemBuilder,
super.itemCount,
- }) : super.builder(itemBuilder: itemBuilder);
+ }) : super.builder();
// TODO(snat-s): DynamicGridView.wrap?
diff --git a/packages/dynamic_layouts/test/dynamic_grid_test.dart b/packages/dynamic_layouts/test/dynamic_grid_test.dart
index 5743eb5..e6ad330 100644
--- a/packages/dynamic_layouts/test/dynamic_grid_test.dart
+++ b/packages/dynamic_layouts/test/dynamic_grid_test.dart
@@ -16,7 +16,6 @@
home: Scaffold(
body: DynamicGridView(
gridDelegate: TestDelegate(crossAxisCount: 2),
- children: const <Widget>[],
),
),
),
@@ -41,7 +40,7 @@
// Only the visible tiles have ben laid out.
expect(find.text('Index 0'), findsOneWidget);
- expect(tester.getTopLeft(find.text('Index 0')), const Offset(0.0, 0.0));
+ expect(tester.getTopLeft(find.text('Index 0')), Offset.zero);
expect(find.text('Index 1'), findsOneWidget);
expect(tester.getTopLeft(find.text('Index 1')), const Offset(50.0, 0.0));
expect(find.text('Index 2'), findsOneWidget);
@@ -72,7 +71,7 @@
// Only the visible tiles have ben laid out, up to itemCount.
expect(find.text('Index 0'), findsOneWidget);
- expect(tester.getTopLeft(find.text('Index 0')), const Offset(0.0, 0.0));
+ expect(tester.getTopLeft(find.text('Index 0')), Offset.zero);
expect(find.text('Index 1'), findsOneWidget);
expect(tester.getTopLeft(find.text('Index 1')), const Offset(50.0, 0.0));
expect(find.text('Index 2'), findsOneWidget);
@@ -100,7 +99,7 @@
// Only the visible tiles have ben laid out.
expect(find.text('Index 0'), findsOneWidget);
- expect(tester.getTopLeft(find.text('Index 0')), const Offset(0.0, 0.0));
+ expect(tester.getTopLeft(find.text('Index 0')), Offset.zero);
expect(find.text('Index 1'), findsOneWidget);
expect(tester.getTopLeft(find.text('Index 1')), const Offset(50.0, 0.0));
expect(find.text('Index 2'), findsOneWidget);
diff --git a/packages/extension_google_sign_in_as_googleapis_auth/CHANGELOG.md b/packages/extension_google_sign_in_as_googleapis_auth/CHANGELOG.md
index 18590a2..64777fa 100644
--- a/packages/extension_google_sign_in_as_googleapis_auth/CHANGELOG.md
+++ b/packages/extension_google_sign_in_as_googleapis_auth/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 2.0.7
+
+* Fixes lint warnings.
+
## 2.0.6
* Drops support for Flutter <2.8.
diff --git a/packages/extension_google_sign_in_as_googleapis_auth/example/lib/main.dart b/packages/extension_google_sign_in_as_googleapis_auth/example/lib/main.dart
index 904bbb7..b8e37b3 100644
--- a/packages/extension_google_sign_in_as_googleapis_auth/example/lib/main.dart
+++ b/packages/extension_google_sign_in_as_googleapis_auth/example/lib/main.dart
@@ -100,7 +100,7 @@
try {
await _googleSignIn.signIn();
} catch (error) {
- print(error);
+ print(error); // ignore: avoid_print
}
}
@@ -122,12 +122,12 @@
const Text('Signed in successfully.'),
Text(_contactText),
ElevatedButton(
- child: const Text('SIGN OUT'),
onPressed: _handleSignOut,
+ child: const Text('SIGN OUT'),
),
ElevatedButton(
- child: const Text('REFRESH'),
onPressed: _handleGetContact,
+ child: const Text('REFRESH'),
),
],
);
@@ -137,8 +137,8 @@
children: <Widget>[
const Text('You are not currently signed in.'),
ElevatedButton(
- child: const Text('SIGN IN'),
onPressed: _handleSignIn,
+ child: const Text('SIGN IN'),
),
],
);
diff --git a/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml b/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml
index 1ff2656..63fea3e 100644
--- a/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml
+++ b/packages/extension_google_sign_in_as_googleapis_auth/pubspec.yaml
@@ -8,7 +8,7 @@
description: A bridge package between google_sign_in and googleapis_auth, to create Authenticated Clients from google_sign_in user credentials.
repository: https://github.com/flutter/packages/tree/main/packages/extension_google_sign_in_as_googleapis_auth
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+extension_google_sign_in_as_googleapis_auth%22
-version: 2.0.6
+version: 2.0.7
environment:
sdk: ">=2.12.0 <3.0.0"
diff --git a/packages/flutter_image/CHANGELOG.md b/packages/flutter_image/CHANGELOG.md
index 39e694a..7413350 100644
--- a/packages/flutter_image/CHANGELOG.md
+++ b/packages/flutter_image/CHANGELOG.md
@@ -1,8 +1,9 @@
-## NEXT
+## 4.1.4
* Ignores lint warnings from new changes in Flutter master.
* Suppresses more deprecation warnings for changes to Flutter master.
* Removes duplicate test from test script.
+* Fixes lint warnings.
## 4.1.3
diff --git a/packages/flutter_image/lib/network.dart b/packages/flutter_image/lib/network.dart
index cbbdee1..109634d 100644
--- a/packages/flutter_image/lib/network.dart
+++ b/packages/flutter_image/lib/network.dart
@@ -227,8 +227,9 @@
if (other.runtimeType != runtimeType) {
return false;
}
- final NetworkImageWithRetry typedOther = other;
- return url == typedOther.url && scale == typedOther.scale;
+ return other is NetworkImageWithRetry &&
+ url == other.url &&
+ scale == other.scale;
}
@override
diff --git a/packages/flutter_image/pubspec.yaml b/packages/flutter_image/pubspec.yaml
index 6e8c362..3fa9421 100644
--- a/packages/flutter_image/pubspec.yaml
+++ b/packages/flutter_image/pubspec.yaml
@@ -3,7 +3,7 @@
Image utilities for Flutter: improved network providers, effects, etc.
repository: https://github.com/flutter/packages/tree/main/packages/flutter_image
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_image%22
-version: 4.1.3
+version: 4.1.4
environment:
sdk: ">=2.12.0 <3.0.0"
diff --git a/packages/flutter_image/test/network_test.dart b/packages/flutter_image/test/network_test.dart
index f559ca2..ecffd29 100644
--- a/packages/flutter_image/test/network_test.dart
+++ b/packages/flutter_image/test/network_test.dart
@@ -85,7 +85,7 @@
});
test('retries 6 times then gives up', () async {
- final dynamic maxAttemptCountReached = expectAsync0(() {});
+ final VoidCallback maxAttemptCountReached = expectAsync0(() {});
int attemptCount = 0;
Future<void> onAttempt() async {
diff --git a/packages/flutter_markdown/CHANGELOG.md b/packages/flutter_markdown/CHANGELOG.md
index d85c36b..c3dc2cc 100644
--- a/packages/flutter_markdown/CHANGELOG.md
+++ b/packages/flutter_markdown/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.6.10+5
+
+* Fixes lint warnings.
+
## 0.6.10+4
* Updates text theme parameters to avoid deprecation issues.
diff --git a/packages/flutter_markdown/example/lib/demos/basic_markdown_demo.dart b/packages/flutter_markdown/example/lib/demos/basic_markdown_demo.dart
index 76557f6..58553ec 100644
--- a/packages/flutter_markdown/example/lib/demos/basic_markdown_demo.dart
+++ b/packages/flutter_markdown/example/lib/demos/basic_markdown_demo.dart
@@ -43,6 +43,8 @@
for the formatted Markdown view in the demo.
""";
+// TODO(goderbauer): Restructure the examples to avoid this ignore, https://github.com/flutter/flutter/issues/110208.
+// ignore: avoid_implementing_value_types
class BasicMarkdownDemo extends StatefulWidget implements MarkdownDemoWidget {
const BasicMarkdownDemo({Key? key}) : super(key: key);
@@ -63,7 +65,7 @@
Future<String> get notes => Future<String>.value(_notes);
@override
- _BasicMarkdownDemoState createState() => _BasicMarkdownDemoState();
+ State<BasicMarkdownDemo> createState() => _BasicMarkdownDemoState();
}
class _BasicMarkdownDemoState extends State<BasicMarkdownDemo> {
diff --git a/packages/flutter_markdown/example/lib/demos/centered_header_demo.dart b/packages/flutter_markdown/example/lib/demos/centered_header_demo.dart
index be5c157..3b344c4 100644
--- a/packages/flutter_markdown/example/lib/demos/centered_header_demo.dart
+++ b/packages/flutter_markdown/example/lib/demos/centered_header_demo.dart
@@ -25,6 +25,8 @@
''';
+// TODO(goderbauer): Restructure the examples to avoid this ignore, https://github.com/flutter/flutter/issues/110208.
+// ignore: avoid_implementing_value_types
class CenteredHeaderDemo extends StatelessWidget implements MarkdownDemoWidget {
const CenteredHeaderDemo({Key? key}) : super(key: key);
diff --git a/packages/flutter_markdown/example/lib/demos/extended_emoji_demo.dart b/packages/flutter_markdown/example/lib/demos/extended_emoji_demo.dart
index 61b217b..4b55c58 100644
--- a/packages/flutter_markdown/example/lib/demos/extended_emoji_demo.dart
+++ b/packages/flutter_markdown/example/lib/demos/extended_emoji_demo.dart
@@ -46,6 +46,8 @@
```
""";
+// TODO(goderbauer): Restructure the examples to avoid this ignore, https://github.com/flutter/flutter/issues/110208.
+// ignore: avoid_implementing_value_types
class ExtendedEmojiDemo extends StatelessWidget implements MarkdownDemoWidget {
const ExtendedEmojiDemo({Key? key}) : super(key: key);
diff --git a/packages/flutter_markdown/example/lib/demos/markdown_body_shrink_wrap_demo.dart b/packages/flutter_markdown/example/lib/demos/markdown_body_shrink_wrap_demo.dart
index 97c3daa..d2de056 100644
--- a/packages/flutter_markdown/example/lib/demos/markdown_body_shrink_wrap_demo.dart
+++ b/packages/flutter_markdown/example/lib/demos/markdown_body_shrink_wrap_demo.dart
@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// TODO(goderbauer): Restructure the examples to avoid this ignore, https://github.com/flutter/flutter/issues/110208.
+// ignore_for_file: avoid_implementing_value_types
+
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import '../shared/dropdown_menu.dart';
diff --git a/packages/flutter_markdown/example/lib/demos/minimal_markdown_demo.dart b/packages/flutter_markdown/example/lib/demos/minimal_markdown_demo.dart
index 9cedd61..cd97424 100644
--- a/packages/flutter_markdown/example/lib/demos/minimal_markdown_demo.dart
+++ b/packages/flutter_markdown/example/lib/demos/minimal_markdown_demo.dart
@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// TODO(goderbauer): Restructure the examples to avoid this ignore, https://github.com/flutter/flutter/issues/110208.
+// ignore_for_file: avoid_implementing_value_types
+
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import '../shared/markdown_demo_widget.dart';
diff --git a/packages/flutter_markdown/example/lib/demos/original_demo.dart b/packages/flutter_markdown/example/lib/demos/original_demo.dart
index f0fd09a..e623b97 100644
--- a/packages/flutter_markdown/example/lib/demos/original_demo.dart
+++ b/packages/flutter_markdown/example/lib/demos/original_demo.dart
@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// TODO(goderbauer): Restructure the examples to avoid this ignore, https://github.com/flutter/flutter/issues/110208.
+// ignore_for_file: avoid_implementing_value_types
+
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import '../shared/markdown_demo_widget.dart';
diff --git a/packages/flutter_markdown/example/lib/demos/subscript_syntax_demo.dart b/packages/flutter_markdown/example/lib/demos/subscript_syntax_demo.dart
index 372168c..5a6e539 100644
--- a/packages/flutter_markdown/example/lib/demos/subscript_syntax_demo.dart
+++ b/packages/flutter_markdown/example/lib/demos/subscript_syntax_demo.dart
@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// TODO(goderbauer): Restructure the examples to avoid this ignore, https://github.com/flutter/flutter/issues/110208.
+// ignore_for_file: avoid_implementing_value_types
+
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:markdown/markdown.dart' as md;
diff --git a/packages/flutter_markdown/example/lib/demos/wrap_alignment_demo.dart b/packages/flutter_markdown/example/lib/demos/wrap_alignment_demo.dart
index c3ca366..da4cbc8 100644
--- a/packages/flutter_markdown/example/lib/demos/wrap_alignment_demo.dart
+++ b/packages/flutter_markdown/example/lib/demos/wrap_alignment_demo.dart
@@ -28,6 +28,8 @@
spacing parameter sets the height of the **SizedBox**.
''';
+// TODO(goderbauer): Restructure the examples to avoid this ignore, https://github.com/flutter/flutter/issues/110208.
+// ignore: avoid_implementing_value_types
class WrapAlignmentDemo extends StatefulWidget implements MarkdownDemoWidget {
const WrapAlignmentDemo({Key? key}) : super(key: key);
@@ -48,7 +50,7 @@
Future<String> get notes => Future<String>.value(_notes);
@override
- _WrapAlignmentDemoState createState() => _WrapAlignmentDemoState();
+ State<WrapAlignmentDemo> createState() => _WrapAlignmentDemoState();
}
class _WrapAlignmentDemoState extends State<WrapAlignmentDemo> {
diff --git a/packages/flutter_markdown/example/lib/shared/dropdown_menu.dart b/packages/flutter_markdown/example/lib/shared/dropdown_menu.dart
index 3d0af77..48388ef 100644
--- a/packages/flutter_markdown/example/lib/shared/dropdown_menu.dart
+++ b/packages/flutter_markdown/example/lib/shared/dropdown_menu.dart
@@ -65,11 +65,11 @@
items: <DropdownMenuItem<T>>[
for (String item in items.keys)
DropdownMenuItem<T>(
+ value: items[item],
child: Container(
padding: const EdgeInsets.only(left: 4),
child: Text(item),
),
- value: items[item],
),
],
onChanged: (T? value) => onChanged!(value),
diff --git a/packages/flutter_markdown/example/pubspec.yaml b/packages/flutter_markdown/example/pubspec.yaml
index 5454129..9cb6fab 100644
--- a/packages/flutter_markdown/example/pubspec.yaml
+++ b/packages/flutter_markdown/example/pubspec.yaml
@@ -9,10 +9,11 @@
dependencies:
flutter:
sdk: flutter
-
-dev_dependencies:
flutter_markdown:
path: ../
+ markdown: 5.0.0
+
+dev_dependencies:
flutter_test:
sdk: flutter
diff --git a/packages/flutter_markdown/lib/src/_functions_io.dart b/packages/flutter_markdown/lib/src/_functions_io.dart
index eb7119b..7c35ba4 100644
--- a/packages/flutter_markdown/lib/src/_functions_io.dart
+++ b/packages/flutter_markdown/lib/src/_functions_io.dart
@@ -60,6 +60,7 @@
MarkdownStyleSheet.fromCupertinoTheme(CupertinoTheme.of(context));
break;
case MarkdownStyleSheetBaseTheme.material:
+ // ignore: no_default_cases
default:
result = MarkdownStyleSheet.fromTheme(Theme.of(context));
}
diff --git a/packages/flutter_markdown/lib/src/_functions_web.dart b/packages/flutter_markdown/lib/src/_functions_web.dart
index 1c34867..a58a9ce 100644
--- a/packages/flutter_markdown/lib/src/_functions_web.dart
+++ b/packages/flutter_markdown/lib/src/_functions_web.dart
@@ -63,7 +63,7 @@
MarkdownStyleSheet.fromCupertinoTheme(CupertinoTheme.of(context));
break;
case MarkdownStyleSheetBaseTheme.material:
- default:
+ default: // ignore: no_default_cases
result = MarkdownStyleSheet.fromTheme(Theme.of(context));
}
diff --git a/packages/flutter_markdown/lib/src/builder.dart b/packages/flutter_markdown/lib/src/builder.dart
index fe7ab32..8c2becf 100644
--- a/packages/flutter_markdown/lib/src/builder.dart
+++ b/packages/flutter_markdown/lib/src/builder.dart
@@ -209,8 +209,9 @@
_addAnonymousBlockIfNeeded();
if (_isListTag(tag)) {
_listIndents.add(tag);
- if (element.attributes['start'] != null)
+ if (element.attributes['start'] != null) {
start = int.parse(element.attributes['start']!) - 1;
+ }
} else if (tag == 'blockquote') {
_isInBlockquote = true;
} else if (tag == 'table') {
@@ -278,7 +279,7 @@
? element.children!
.map((md.Node e) =>
e is md.Text ? e.text : extractTextFromElement(e))
- .join('')
+ .join()
: (element is md.Element && (element.attributes.isNotEmpty)
? element.attributes['alt']
: '');
@@ -298,13 +299,13 @@
String trimText(String text) {
// The leading spaces pattern is used to identify spaces
// at the beginning of a line of text.
- final RegExp _leadingSpacesPattern = RegExp(r'^ *');
+ final RegExp leadingSpacesPattern = RegExp(r'^ *');
// The soft line break is used to identify the spaces at the end of a line
// of text and the leading spaces in the immediately following the line
// of text. These spaces are removed in accordance with the Markdown
// specification on soft line breaks when lines of text are joined.
- final RegExp _softLineBreak = RegExp(r' ?\n *');
+ final RegExp softLineBreakPattern = RegExp(r' ?\n *');
// Leading spaces following a hard line break are ignored.
// https://github.github.com/gfm/#example-657
@@ -312,13 +313,13 @@
// https://github.github.com/gfm/#example-192
// https://github.github.com/gfm/#example-236
if (const <String>['ul', 'ol', 'p', 'br'].contains(_lastVisitedTag)) {
- text = text.replaceAll(_leadingSpacesPattern, '');
+ text = text.replaceAll(leadingSpacesPattern, '');
}
if (softLineBreak) {
return text;
}
- return text.replaceAll(_softLineBreak, ' ');
+ return text.replaceAll(softLineBreakPattern, ' ');
}
Widget? child;
@@ -530,7 +531,7 @@
if (_linkHandlers.isNotEmpty) {
final TapGestureRecognizer recognizer =
_linkHandlers.last as TapGestureRecognizer;
- return GestureDetector(child: child, onTap: recognizer.onTap);
+ return GestureDetector(onTap: recognizer.onTap, child: child);
} else {
return child;
}
@@ -648,8 +649,8 @@
);
final Wrap wrap = Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
- children: mergedInlines,
alignment: blockAlignment,
+ children: mergedInlines,
);
if (textPadding == EdgeInsets.zero) {
@@ -757,9 +758,13 @@
case 'pre':
return styleSheet.codeblockAlign;
case 'hr':
+ // TODO(goderbauer): We shouldn't be printing here, https://github.com/flutter/flutter/issues/110209
+ // ignore: avoid_print
print('Markdown did not handle hr for alignment');
break;
case 'li':
+ // TODO(goderbauer): We shouldn't be printing here, https://github.com/flutter/flutter/issues/110209
+ // ignore: avoid_print
print('Markdown did not handle li for alignment');
break;
}
diff --git a/packages/flutter_markdown/lib/src/style_sheet.dart b/packages/flutter_markdown/lib/src/style_sheet.dart
index f9feee0..31ecc3e 100644
--- a/packages/flutter_markdown/lib/src/style_sheet.dart
+++ b/packages/flutter_markdown/lib/src/style_sheet.dart
@@ -123,7 +123,6 @@
tableHeadAlign: TextAlign.center,
tableBorder: TableBorder.all(
color: theme.dividerColor,
- width: 1,
),
tableColumnWidth: const FlexColumnWidth(),
tableCellsPadding: const EdgeInsets.fromLTRB(16, 8, 16, 8),
@@ -253,7 +252,6 @@
color: theme.brightness == Brightness.dark
? CupertinoColors.systemGrey4.darkColor
: CupertinoColors.systemGrey4.color,
- width: 1,
),
),
),
@@ -660,57 +658,57 @@
if (other.runtimeType != MarkdownStyleSheet) {
return false;
}
- final MarkdownStyleSheet typedOther = other;
- return typedOther.a == a &&
- typedOther.p == p &&
- typedOther.pPadding == pPadding &&
- typedOther.code == code &&
- typedOther.h1 == h1 &&
- typedOther.h1Padding == h1Padding &&
- typedOther.h2 == h2 &&
- typedOther.h2Padding == h2Padding &&
- typedOther.h3 == h3 &&
- typedOther.h3Padding == h3Padding &&
- typedOther.h4 == h4 &&
- typedOther.h4Padding == h4Padding &&
- typedOther.h5 == h5 &&
- typedOther.h5Padding == h5Padding &&
- typedOther.h6 == h6 &&
- typedOther.h6Padding == h6Padding &&
- typedOther.em == em &&
- typedOther.strong == strong &&
- typedOther.del == del &&
- typedOther.blockquote == blockquote &&
- typedOther.img == img &&
- typedOther.checkbox == checkbox &&
- typedOther.blockSpacing == blockSpacing &&
- typedOther.listIndent == listIndent &&
- typedOther.listBullet == listBullet &&
- typedOther.listBulletPadding == listBulletPadding &&
- typedOther.tableHead == tableHead &&
- typedOther.tableBody == tableBody &&
- typedOther.tableHeadAlign == tableHeadAlign &&
- typedOther.tableBorder == tableBorder &&
- typedOther.tableColumnWidth == tableColumnWidth &&
- typedOther.tableCellsPadding == tableCellsPadding &&
- typedOther.tableCellsDecoration == tableCellsDecoration &&
- typedOther.blockquotePadding == blockquotePadding &&
- typedOther.blockquoteDecoration == blockquoteDecoration &&
- typedOther.codeblockPadding == codeblockPadding &&
- typedOther.codeblockDecoration == codeblockDecoration &&
- typedOther.horizontalRuleDecoration == horizontalRuleDecoration &&
- typedOther.textAlign == textAlign &&
- typedOther.h1Align == h1Align &&
- typedOther.h2Align == h2Align &&
- typedOther.h3Align == h3Align &&
- typedOther.h4Align == h4Align &&
- typedOther.h5Align == h5Align &&
- typedOther.h6Align == h6Align &&
- typedOther.unorderedListAlign == unorderedListAlign &&
- typedOther.orderedListAlign == orderedListAlign &&
- typedOther.blockquoteAlign == blockquoteAlign &&
- typedOther.codeblockAlign == codeblockAlign &&
- typedOther.textScaleFactor == textScaleFactor;
+ return other is MarkdownStyleSheet &&
+ other.a == a &&
+ other.p == p &&
+ other.pPadding == pPadding &&
+ other.code == code &&
+ other.h1 == h1 &&
+ other.h1Padding == h1Padding &&
+ other.h2 == h2 &&
+ other.h2Padding == h2Padding &&
+ other.h3 == h3 &&
+ other.h3Padding == h3Padding &&
+ other.h4 == h4 &&
+ other.h4Padding == h4Padding &&
+ other.h5 == h5 &&
+ other.h5Padding == h5Padding &&
+ other.h6 == h6 &&
+ other.h6Padding == h6Padding &&
+ other.em == em &&
+ other.strong == strong &&
+ other.del == del &&
+ other.blockquote == blockquote &&
+ other.img == img &&
+ other.checkbox == checkbox &&
+ other.blockSpacing == blockSpacing &&
+ other.listIndent == listIndent &&
+ other.listBullet == listBullet &&
+ other.listBulletPadding == listBulletPadding &&
+ other.tableHead == tableHead &&
+ other.tableBody == tableBody &&
+ other.tableHeadAlign == tableHeadAlign &&
+ other.tableBorder == tableBorder &&
+ other.tableColumnWidth == tableColumnWidth &&
+ other.tableCellsPadding == tableCellsPadding &&
+ other.tableCellsDecoration == tableCellsDecoration &&
+ other.blockquotePadding == blockquotePadding &&
+ other.blockquoteDecoration == blockquoteDecoration &&
+ other.codeblockPadding == codeblockPadding &&
+ other.codeblockDecoration == codeblockDecoration &&
+ other.horizontalRuleDecoration == horizontalRuleDecoration &&
+ other.textAlign == textAlign &&
+ other.h1Align == h1Align &&
+ other.h2Align == h2Align &&
+ other.h3Align == h3Align &&
+ other.h4Align == h4Align &&
+ other.h5Align == h5Align &&
+ other.h6Align == h6Align &&
+ other.unorderedListAlign == unorderedListAlign &&
+ other.orderedListAlign == orderedListAlign &&
+ other.blockquoteAlign == blockquoteAlign &&
+ other.codeblockAlign == codeblockAlign &&
+ other.textScaleFactor == textScaleFactor;
}
@override
diff --git a/packages/flutter_markdown/lib/src/widget.dart b/packages/flutter_markdown/lib/src/widget.dart
index 6a0c28a..17f7406 100644
--- a/packages/flutter_markdown/lib/src/widget.dart
+++ b/packages/flutter_markdown/lib/src/widget.dart
@@ -7,9 +7,9 @@
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
-import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:markdown/markdown.dart' as md;
+import '../flutter_markdown.dart';
import '_functions_io.dart' if (dart.library.html) '_functions_web.dart';
/// Signature for callbacks used by [MarkdownWidget] when the user taps a link.
@@ -271,7 +271,7 @@
Widget build(BuildContext context, List<Widget>? children);
@override
- _MarkdownWidgetState createState() => _MarkdownWidgetState();
+ State<MarkdownWidget> createState() => _MarkdownWidgetState();
}
class _MarkdownWidgetState extends State<MarkdownWidget>
@@ -348,8 +348,9 @@
final List<GestureRecognizer> localRecognizers =
List<GestureRecognizer>.from(_recognizers);
_recognizers.clear();
- for (final GestureRecognizer recognizer in localRecognizers)
+ for (final GestureRecognizer recognizer in localRecognizers) {
recognizer.dispose();
+ }
}
@override
diff --git a/packages/flutter_markdown/pubspec.yaml b/packages/flutter_markdown/pubspec.yaml
index 8aefa93..e6e8ac4 100644
--- a/packages/flutter_markdown/pubspec.yaml
+++ b/packages/flutter_markdown/pubspec.yaml
@@ -4,7 +4,7 @@
formatted with simple Markdown tags.
repository: https://github.com/flutter/packages/tree/main/packages/flutter_markdown
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_markdown%22
-version: 0.6.10+4
+version: 0.6.10+5
environment:
sdk: ">=2.12.0 <3.0.0"
diff --git a/packages/flutter_markdown/test/html_test.dart b/packages/flutter_markdown/test/html_test.dart
index aa11952..11525d5 100644
--- a/packages/flutter_markdown/test/html_test.dart
+++ b/packages/flutter_markdown/test/html_test.dart
@@ -29,7 +29,7 @@
);
testWidgets(
- 'doesn\'t convert & to & when parsing',
+ "doesn't convert & to & when parsing",
(WidgetTester tester) async {
await tester.pumpWidget(
boilerplate(
@@ -41,7 +41,7 @@
);
testWidgets(
- 'doesn\'t convert < to < when parsing',
+ "doesn't convert < to < when parsing",
(WidgetTester tester) async {
await tester.pumpWidget(
boilerplate(
@@ -53,7 +53,7 @@
);
testWidgets(
- 'doesn\'t convert existing HTML entities when parsing',
+ "doesn't convert existing HTML entities when parsing",
(WidgetTester tester) async {
await tester.pumpWidget(
boilerplate(
diff --git a/packages/flutter_markdown/test/image_test_mocks.dart b/packages/flutter_markdown/test/image_test_mocks.dart
index 8888361..3aab6e8 100644
--- a/packages/flutter_markdown/test/image_test_mocks.dart
+++ b/packages/flutter_markdown/test/image_test_mocks.dart
@@ -21,7 +21,7 @@
final MockHttpClientResponse response = MockHttpClientResponse();
final MockHttpHeaders headers = MockHttpHeaders();
- final List<int> _transparentImage = getTestImageData();
+ final List<int> transparentImage = getTestImageData();
when(client.getUrl(any))
.thenAnswer((_) => Future<MockHttpClientRequest>.value(request));
@@ -33,7 +33,7 @@
when(client.autoUncompress = any).thenAnswer((_) => null);
- when(response.contentLength).thenReturn(_transparentImage.length);
+ when(response.contentLength).thenReturn(transparentImage.length);
when(response.statusCode).thenReturn(HttpStatus.ok);
@@ -49,8 +49,7 @@
invocation.namedArguments[#onError];
final bool? cancelOnError = invocation.namedArguments[#cancelOnError];
- return Stream<List<int>>.fromIterable(<List<int>>[_transparentImage])
- .listen(
+ return Stream<List<int>>.fromIterable(<List<int>>[transparentImage]).listen(
onData,
onError: onError,
onDone: onDone,
@@ -94,6 +93,7 @@
/// Define the "fake" data types to be used in mock data type definitions. These
/// fake data types are important in the definition of the return values of the
/// properties and methods of the mock data types for null safety.
+// ignore: avoid_implementing_value_types
class _FakeDuration extends Fake implements Duration {}
class _FakeHttpClientRequest extends Fake implements HttpClientRequest {}
@@ -123,8 +123,8 @@
returnValue: _FakeDuration()) as Duration;
@override
- set idleTimeout(Duration? _idleTimeout) =>
- super.noSuchMethod(Invocation.setter(#idleTimeout, _idleTimeout));
+ set idleTimeout(Duration? idleTimeout) =>
+ super.noSuchMethod(Invocation.setter(#idleTimeout, idleTimeout));
@override
bool get autoUncompress =>
@@ -132,8 +132,8 @@
as bool;
@override
- set autoUncompress(bool? _autoUncompress) =>
- super.noSuchMethod(Invocation.setter(#autoUncompress, _autoUncompress));
+ set autoUncompress(bool? autoUncompress) =>
+ super.noSuchMethod(Invocation.setter(#autoUncompress, autoUncompress));
@override
Future<HttpClientRequest> open(
@@ -259,8 +259,8 @@
returnValue: false) as bool;
@override
- set persistentConnection(bool? _persistentConnection) => super.noSuchMethod(
- Invocation.setter(#persistentConnection, _persistentConnection));
+ set persistentConnection(bool? persistentConnection) => super.noSuchMethod(
+ Invocation.setter(#persistentConnection, persistentConnection));
@override
bool get followRedirects => super
@@ -268,8 +268,8 @@
as bool;
@override
- set followRedirects(bool? _followRedirects) =>
- super.noSuchMethod(Invocation.setter(#followRedirects, _followRedirects));
+ set followRedirects(bool? followRedirects) =>
+ super.noSuchMethod(Invocation.setter(#followRedirects, followRedirects));
@override
int get maxRedirects =>
@@ -277,8 +277,8 @@
as int;
@override
- set maxRedirects(int? _maxRedirects) =>
- super.noSuchMethod(Invocation.setter(#maxRedirects, _maxRedirects));
+ set maxRedirects(int? maxRedirects) =>
+ super.noSuchMethod(Invocation.setter(#maxRedirects, maxRedirects));
@override
int get contentLength =>
@@ -286,8 +286,8 @@
as int;
@override
- set contentLength(int? _contentLength) =>
- super.noSuchMethod(Invocation.setter(#contentLength, _contentLength));
+ set contentLength(int? contentLength) =>
+ super.noSuchMethod(Invocation.setter(#contentLength, contentLength));
@override
bool get bufferOutput =>
@@ -295,8 +295,8 @@
as bool;
@override
- set bufferOutput(bool? _bufferOutput) =>
- super.noSuchMethod(Invocation.setter(#bufferOutput, _bufferOutput));
+ set bufferOutput(bool? bufferOutput) =>
+ super.noSuchMethod(Invocation.setter(#bufferOutput, bufferOutput));
@override
String get method =>
@@ -428,8 +428,8 @@
as int;
@override
- set contentLength(int? _contentLength) =>
- super.noSuchMethod(Invocation.setter(#contentLength, _contentLength));
+ set contentLength(int? contentLength) =>
+ super.noSuchMethod(Invocation.setter(#contentLength, contentLength));
@override
bool get persistentConnection =>
@@ -437,8 +437,8 @@
returnValue: false) as bool;
@override
- set persistentConnection(bool? _persistentConnection) => super.noSuchMethod(
- Invocation.setter(#persistentConnection, _persistentConnection));
+ set persistentConnection(bool? persistentConnection) => super.noSuchMethod(
+ Invocation.setter(#persistentConnection, persistentConnection));
@override
bool get chunkedTransferEncoding =>
@@ -446,9 +446,9 @@
returnValue: false) as bool;
@override
- set chunkedTransferEncoding(bool? _chunkedTransferEncoding) =>
- super.noSuchMethod(Invocation.setter(
- #chunkedTransferEncoding, _chunkedTransferEncoding));
+ set chunkedTransferEncoding(bool? chunkedTransferEncoding) =>
+ super.noSuchMethod(
+ Invocation.setter(#chunkedTransferEncoding, chunkedTransferEncoding));
@override
List<String>? operator [](String? name) =>
diff --git a/packages/flutter_markdown/test/link_test.dart b/packages/flutter_markdown/test/link_test.dart
index fca6a26..3ddab99 100644
--- a/packages/flutter_markdown/test/link_test.dart
+++ b/packages/flutter_markdown/test/link_test.dart
@@ -702,7 +702,7 @@
// Example 513b from GFM.
'link title in single quotes',
(WidgetTester tester) async {
- const String data = '[link](/url \'title\')';
+ const String data = "[link](/url 'title')";
MarkdownLink? linkTapResults;
await tester.pumpWidget(
boilerplate(
@@ -1202,7 +1202,7 @@
testWidgets(
// Example 531 from GFM.
- 'brackets that aren\'t part of links do not take precedence',
+ "brackets that aren't part of links do not take precedence",
(WidgetTester tester) async {
const String data = '*foo [bar* baz]';
await tester.pumpWidget(
diff --git a/packages/flutter_markdown/test/markdown_body_shrink_wrap_test.dart b/packages/flutter_markdown/test/markdown_body_shrink_wrap_test.dart
index 4cf2afc..8cb89a2 100644
--- a/packages/flutter_markdown/test/markdown_body_shrink_wrap_test.dart
+++ b/packages/flutter_markdown/test/markdown_body_shrink_wrap_test.dart
@@ -22,7 +22,6 @@
alignment: Alignment.bottomCenter,
child: MarkdownBody(
data: 'This is a [link](https://flutter.dev/)',
- shrinkWrap: true,
),
),
],
diff --git a/packages/flutter_markdown/test/scrollable_test.dart b/packages/flutter_markdown/test/scrollable_test.dart
index e7ace8a..a0cdfe9 100644
--- a/packages/flutter_markdown/test/scrollable_test.dart
+++ b/packages/flutter_markdown/test/scrollable_test.dart
@@ -15,7 +15,7 @@
'code block',
(WidgetTester tester) async {
const String data =
- '```\nvoid main() {\n print(\'Hello World!\');\n}\n```';
+ "```\nvoid main() {\n print('Hello World!');\n}\n```";
await tester.pumpWidget(
boilerplate(
diff --git a/packages/flutter_markdown/test/utils.dart b/packages/flutter_markdown/test/utils.dart
index 3286260..f4ebb95 100644
--- a/packages/flutter_markdown/test/utils.dart
+++ b/packages/flutter_markdown/test/utils.dart
@@ -10,10 +10,9 @@
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
-final TextTheme textTheme =
- Typography.material2018(platform: TargetPlatform.android)
- .black
- .merge(const TextTheme(bodyMedium: TextStyle(fontSize: 12.0)));
+final TextTheme textTheme = Typography.material2018()
+ .black
+ .merge(const TextTheme(bodyMedium: TextStyle(fontSize: 12.0)));
void expectWidgetTypes(Iterable<Widget> widgets, List<Type> expected) {
final List<Type> actual = widgets.map((Widget w) => w.runtimeType).toList();
@@ -182,7 +181,7 @@
// verses 'flutter test test/*_test.dart'. Adjust the root directory
// to access the assets directory.
final io.Directory rootDirectory =
- io.Directory.current.path.endsWith(io.Platform.pathSeparator + 'test')
+ io.Directory.current.path.endsWith('${io.Platform.pathSeparator}test')
? io.Directory.current.parent
: io.Directory.current;
final io.File file =
@@ -194,7 +193,7 @@
}
return asset;
} else {
- throw 'Unknown asset key: $key';
+ throw ArgumentError('Unknown asset key: $key');
}
}
}
diff --git a/packages/fuchsia_ctl/CHANGELOG.md b/packages/fuchsia_ctl/CHANGELOG.md
index b6d5db8..25aacf7 100644
--- a/packages/fuchsia_ctl/CHANGELOG.md
+++ b/packages/fuchsia_ctl/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 0.0.25+1
+
+- Fixes lint warnings.
+
+
## 0.0.25
- Fix `unnecessary_import` lint errors.
diff --git a/packages/fuchsia_ctl/bin/main.dart b/packages/fuchsia_ctl/bin/main.dart
index ca7f8f9..95d2712 100644
--- a/packages/fuchsia_ctl/bin/main.dart
+++ b/packages/fuchsia_ctl/bin/main.dart
@@ -182,7 +182,7 @@
final OperationResult result = await sshClient.runCommand(
targetIp,
identityFilePath: identityFile,
- command: args['command'].split(' '),
+ command: (args['command'] as String).split(' '),
timeoutMs:
Duration(milliseconds: int.parse(args['timeout-seconds']) * 1000),
logFilePath: outputFile,
@@ -203,7 +203,6 @@
) async {
const ImagePaver paver = ImagePaver();
const RetryOptions r = RetryOptions(
- maxDelay: Duration(seconds: 30),
maxAttempts: 3,
);
return r.retry(() async {
@@ -268,7 +267,7 @@
final String repositoryBase = path.join(repo.path, 'amber-files');
stdout.writeln('Serving $repositoryBase to $targetIp');
- await server.serveRepo(repositoryBase, port: 0);
+ await server.serveRepo(repositoryBase);
await amberCtl.addSrc(server.serverPort);
stdout.writeln('Pushing packages $packages to $targetIp');
@@ -335,7 +334,7 @@
return result;
}
}
- await server.serveRepo(repo.path, port: 0);
+ await server.serveRepo(repo.path);
await amberCtl.addSrc(server.serverPort);
for (final String farFile in farFiles) {
diff --git a/packages/fuchsia_ctl/lib/src/amber_ctl.dart b/packages/fuchsia_ctl/lib/src/amber_ctl.dart
index 8124cd0..1b79f50 100644
--- a/packages/fuchsia_ctl/lib/src/amber_ctl.dart
+++ b/packages/fuchsia_ctl/lib/src/amber_ctl.dart
@@ -4,10 +4,11 @@
import 'dart:io';
-import 'package:fuchsia_ctl/fuchsia_ctl.dart';
import 'package:meta/meta.dart';
import 'package:uuid/uuid.dart';
+import '../fuchsia_ctl.dart';
+
const SshClient _kSsh = SshClient();
/// Wrapper for amberctl utility for commands executed on the target device.
diff --git a/packages/fuchsia_ctl/lib/src/emulator.dart b/packages/fuchsia_ctl/lib/src/emulator.dart
index 9ab5aff..5d7f792 100644
--- a/packages/fuchsia_ctl/lib/src/emulator.dart
+++ b/packages/fuchsia_ctl/lib/src/emulator.dart
@@ -180,7 +180,7 @@
'-device', 'virtio-blk-pci,drive=vdisk',
'-append',
// TODO(chillers): Generate entropy mixin.
- '\'TERM=xterm-256color kernel.serial=legacy kernel.entropy-mixin=660486b6b20b4ace3fb5c81b0002abf5271289185c6a5620707606c55b377562 kernel.halt-on-panic=true\'',
+ "'TERM=xterm-256color kernel.serial=legacy kernel.entropy-mixin=660486b6b20b4ace3fb5c81b0002abf5271289185c6a5620707606c55b377562 kernel.halt-on-panic=true'",
];
await cli.start(aemuCommand);
diff --git a/packages/fuchsia_ctl/lib/src/image_paver.dart b/packages/fuchsia_ctl/lib/src/image_paver.dart
index 02cded0..7129b48 100644
--- a/packages/fuchsia_ctl/lib/src/image_paver.dart
+++ b/packages/fuchsia_ctl/lib/src/image_paver.dart
@@ -26,7 +26,7 @@
const ImagePaver({
this.processManager = const LocalProcessManager(),
this.fs = const LocalFileSystem(),
- this.tar = const SystemTar(processManager: LocalProcessManager()),
+ this.tar = const SystemTar(),
this.sshKeyManagerProvider = SystemSshKeyManager.defaultProvider,
}) : assert(processManager != null),
assert(fs != null),
diff --git a/packages/fuchsia_ctl/lib/src/operation_result.dart b/packages/fuchsia_ctl/lib/src/operation_result.dart
index 637e3a6..0bf49dc 100644
--- a/packages/fuchsia_ctl/lib/src/operation_result.dart
+++ b/packages/fuchsia_ctl/lib/src/operation_result.dart
@@ -24,7 +24,7 @@
String info = '',
}) {
assert(info != null);
- return OperationResult._(true, info: info, error: '');
+ return OperationResult._(true, info: info);
}
/// A failing operation result with a non-null but potentially empty error,
diff --git a/packages/fuchsia_ctl/lib/src/package_server.dart b/packages/fuchsia_ctl/lib/src/package_server.dart
index 96f8d4f..6476ef6 100644
--- a/packages/fuchsia_ctl/lib/src/package_server.dart
+++ b/packages/fuchsia_ctl/lib/src/package_server.dart
@@ -8,11 +8,12 @@
import 'package:file/file.dart';
import 'package:file/local.dart';
-import 'package:fuchsia_ctl/fuchsia_ctl.dart';
import 'package:path/path.dart' as path;
import 'package:process/process.dart';
import 'package:uuid/uuid.dart';
+import '../fuchsia_ctl.dart';
+
/// A wrapper around the Fuchsia SDK `pm` tool.
class PackageServer {
/// Creates a new package server.
diff --git a/packages/fuchsia_ctl/lib/src/ssh_client.dart b/packages/fuchsia_ctl/lib/src/ssh_client.dart
index 33b87e2..12e1881 100644
--- a/packages/fuchsia_ctl/lib/src/ssh_client.dart
+++ b/packages/fuchsia_ctl/lib/src/ssh_client.dart
@@ -8,10 +8,10 @@
import 'package:file/file.dart';
import 'package:file/local.dart';
-import 'package:fuchsia_ctl/src/logger.dart';
import 'package:meta/meta.dart';
import 'package:process/process.dart';
+import 'logger.dart';
import 'operation_result.dart';
/// A client for running SSH based commands on a Fuchsia device.
diff --git a/packages/fuchsia_ctl/pubspec.yaml b/packages/fuchsia_ctl/pubspec.yaml
index 16e1a34..1cacbc3 100644
--- a/packages/fuchsia_ctl/pubspec.yaml
+++ b/packages/fuchsia_ctl/pubspec.yaml
@@ -6,7 +6,7 @@
publish_to: none
repository: https://github.com/flutter/packages/tree/main/packages/fuchsia_ctl
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+fuchsia_ctl%22
-version: 0.0.25
+version: 0.0.25+1
environment:
sdk: ">=2.4.0 <3.0.0"
diff --git a/packages/fuchsia_ctl/test/emulator_test.dart b/packages/fuchsia_ctl/test/emulator_test.dart
index 8af8a00..dc5c3e9 100644
--- a/packages/fuchsia_ctl/test/emulator_test.dart
+++ b/packages/fuchsia_ctl/test/emulator_test.dart
@@ -23,7 +23,7 @@
group('Emulator', () {
setUp(() {
mockCli = MockCommandLine();
- fs = MemoryFileSystem(style: FileSystemStyle.posix);
+ fs = MemoryFileSystem();
fs.file(aemuPath).createSync();
fs.file(fuchsiaImagePath)
..createSync()
diff --git a/packages/fuchsia_ctl/test/image_paver_test.dart b/packages/fuchsia_ctl/test/image_paver_test.dart
index d57e237..d4a6360 100644
--- a/packages/fuchsia_ctl/test/image_paver_test.dart
+++ b/packages/fuchsia_ctl/test/image_paver_test.dart
@@ -17,7 +17,7 @@
void main() {
const String deviceName = 'some-name-to-use';
FakeSshKeyManager sshKeyManager;
- final MemoryFileSystem fs = MemoryFileSystem(style: FileSystemStyle.posix);
+ final MemoryFileSystem fs = MemoryFileSystem();
FakeTar tar;
MockProcessManager processManager;
SshKeyManagerProvider sshKeyManagerProvider;
diff --git a/packages/fuchsia_ctl/test/logger_test.dart b/packages/fuchsia_ctl/test/logger_test.dart
index 6223276..bffaacf 100644
--- a/packages/fuchsia_ctl/test/logger_test.dart
+++ b/packages/fuchsia_ctl/test/logger_test.dart
@@ -43,7 +43,7 @@
final MemoryFileSystem fs = MemoryFileSystem();
fs.file('log.txt').createSync();
final IOSink data = fs.file('log.txt').openWrite();
- final PrintLogger logger = PrintLogger(out: data, level: LogLevel.info);
+ final PrintLogger logger = PrintLogger(out: data);
logger.debug('abc');
logger.info('cdf');
logger.warning('gh');
diff --git a/packages/fuchsia_ctl/test/package_server_test.dart b/packages/fuchsia_ctl/test/package_server_test.dart
index 7413292..5b111d9 100644
--- a/packages/fuchsia_ctl/test/package_server_test.dart
+++ b/packages/fuchsia_ctl/test/package_server_test.dart
@@ -109,7 +109,6 @@
await server.serveRepo(
repoPath,
- port: 0,
portFilePath: portFile.path,
);
expect(server.serving, true);
diff --git a/packages/go_router/CHANGELOG.md b/packages/go_router/CHANGELOG.md
index be1fbca..b97be1b 100644
--- a/packages/go_router/CHANGELOG.md
+++ b/packages/go_router/CHANGELOG.md
@@ -1,6 +1,7 @@
-## NEXT
+## 4.2.9
* Updates text theme parameters to avoid deprecation issues.
+* Fixes lint warnings.
## 4.2.8
diff --git a/packages/go_router/example/lib/books/src/screens/books.dart b/packages/go_router/example/lib/books/src/screens/books.dart
index 76f77b4..ea86848 100644
--- a/packages/go_router/example/lib/books/src/screens/books.dart
+++ b/packages/go_router/example/lib/books/src/screens/books.dart
@@ -17,7 +17,7 @@
final String kind;
@override
- _BooksScreenState createState() => _BooksScreenState();
+ State<BooksScreen> createState() => _BooksScreenState();
}
class _BooksScreenState extends State<BooksScreen>
diff --git a/packages/go_router/example/lib/books/src/screens/settings.dart b/packages/go_router/example/lib/books/src/screens/settings.dart
index a376ce2..71bd0f8 100644
--- a/packages/go_router/example/lib/books/src/screens/settings.dart
+++ b/packages/go_router/example/lib/books/src/screens/settings.dart
@@ -14,7 +14,7 @@
const SettingsScreen({Key? key}) : super(key: key);
@override
- _SettingsScreenState createState() => _SettingsScreenState();
+ State<SettingsScreen> createState() => _SettingsScreenState();
}
class _SettingsScreenState extends State<SettingsScreen> {
diff --git a/packages/go_router/example/lib/books/src/screens/sign_in.dart b/packages/go_router/example/lib/books/src/screens/sign_in.dart
index 1f833bf..533322b 100644
--- a/packages/go_router/example/lib/books/src/screens/sign_in.dart
+++ b/packages/go_router/example/lib/books/src/screens/sign_in.dart
@@ -28,7 +28,7 @@
final ValueChanged<Credentials> onSignIn;
@override
- _SignInScreenState createState() => _SignInScreenState();
+ State<SignInScreen> createState() => _SignInScreenState();
}
class _SignInScreenState extends State<SignInScreen> {
diff --git a/packages/go_router/example/lib/named_routes.dart b/packages/go_router/example/lib/named_routes.dart
index a8f9ce3..adb21e7 100644
--- a/packages/go_router/example/lib/named_routes.dart
+++ b/packages/go_router/example/lib/named_routes.dart
@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// TODO(goderbauer): Refactor the examples to remove this ignore, https://github.com/flutter/flutter/issues/110210
+// ignore_for_file: avoid_dynamic_calls
+
import 'dart:convert';
import 'package:flutter/material.dart';
diff --git a/packages/go_router/example/lib/others/extra_param.dart b/packages/go_router/example/lib/others/extra_param.dart
index 7917bbb..3b6ca0e 100644
--- a/packages/go_router/example/lib/others/extra_param.dart
+++ b/packages/go_router/example/lib/others/extra_param.dart
@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// TODO(goderbauer): Refactor the examples to remove this ignore, https://github.com/flutter/flutter/issues/110210
+// ignore_for_file: avoid_dynamic_calls
+
import 'dart:convert';
import 'package:flutter/material.dart';
diff --git a/packages/go_router/example/lib/path_and_query_parameters.dart b/packages/go_router/example/lib/path_and_query_parameters.dart
index 38af018..fe9b8ba 100755
--- a/packages/go_router/example/lib/path_and_query_parameters.dart
+++ b/packages/go_router/example/lib/path_and_query_parameters.dart
@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// TODO(goderbauer): Refactor the examples to remove this ignore, https://github.com/flutter/flutter/issues/110210
+// ignore_for_file: avoid_dynamic_calls
+
import 'dart:convert';
import 'package:flutter/material.dart';
diff --git a/packages/go_router/lib/go_router.dart b/packages/go_router/lib/go_router.dart
index efb52fd..431bf3d 100644
--- a/packages/go_router/lib/go_router.dart
+++ b/packages/go_router/lib/go_router.dart
@@ -6,7 +6,7 @@
/// deep linking, data-driven routes and more.
library go_router;
-export 'src/configuration.dart' show GoRouterState, GoRoute;
+export 'src/configuration.dart' show GoRoute, GoRouterState;
export 'src/misc/extensions.dart';
export 'src/misc/inherited_router.dart';
export 'src/misc/refresh_stream.dart';
diff --git a/packages/go_router/lib/src/information_provider.dart b/packages/go_router/lib/src/information_provider.dart
index 0afeee5..3011d13 100644
--- a/packages/go_router/lib/src/information_provider.dart
+++ b/packages/go_router/lib/src/information_provider.dart
@@ -115,6 +115,5 @@
/// in use with the [GoRouteInformationParser].
class DebugGoRouteInformation extends RouteInformation {
/// Creates a [DebugGoRouteInformation].
- DebugGoRouteInformation({String? location, Object? state})
- : super(location: location, state: state);
+ DebugGoRouteInformation({super.location, super.state});
}
diff --git a/packages/go_router/lib/src/matching.dart b/packages/go_router/lib/src/matching.dart
index 755aed6..6135cff 100644
--- a/packages/go_router/lib/src/matching.dart
+++ b/packages/go_router/lib/src/matching.dart
@@ -100,8 +100,7 @@
/// An error that occurred during matching.
class MatcherError extends Error {
/// Constructs a [MatcherError].
- MatcherError(String message, this.location)
- : message = message + ': $location';
+ MatcherError(String message, this.location) : message = '$message: $location';
/// The error message.
final String message;
diff --git a/packages/go_router/lib/src/misc/error_screen.dart b/packages/go_router/lib/src/misc/error_screen.dart
index 4572b97..1d0884c 100644
--- a/packages/go_router/lib/src/misc/error_screen.dart
+++ b/packages/go_router/lib/src/misc/error_screen.dart
@@ -9,7 +9,7 @@
/// Default error page implementation for WidgetsApp.
class ErrorScreen extends StatelessWidget {
/// Provide an exception to this page for it to be displayed.
- const ErrorScreen(this.error, {Key? key}) : super(key: key);
+ const ErrorScreen(this.error, {super.key});
/// The exception to be displayed.
final Exception? error;
@@ -46,8 +46,7 @@
const _Button({
required this.onPressed,
required this.child,
- Key? key,
- }) : super(key: key);
+ });
final VoidCallback onPressed;
diff --git a/packages/go_router/lib/src/misc/inherited_router.dart b/packages/go_router/lib/src/misc/inherited_router.dart
index 3aec902..abc5a9d 100644
--- a/packages/go_router/lib/src/misc/inherited_router.dart
+++ b/packages/go_router/lib/src/misc/inherited_router.dart
@@ -14,10 +14,10 @@
class InheritedGoRouter extends InheritedWidget {
/// Default constructor for the inherited go router.
const InheritedGoRouter({
- required Widget child,
+ required super.child,
required this.goRouter,
- Key? key,
- }) : super(child: child, key: key);
+ super.key,
+ });
/// The [GoRouter] that is made available to the widget tree.
final GoRouter goRouter;
diff --git a/packages/go_router/lib/src/pages/cupertino.dart b/packages/go_router/lib/src/pages/cupertino.dart
index 6c9d1a9..2532b54 100644
--- a/packages/go_router/lib/src/pages/cupertino.dart
+++ b/packages/go_router/lib/src/pages/cupertino.dart
@@ -30,7 +30,7 @@
/// Default error page implementation for Cupertino.
class CupertinoErrorScreen extends StatelessWidget {
/// Provide an exception to this page for it to be displayed.
- const CupertinoErrorScreen(this.error, {Key? key}) : super(key: key);
+ const CupertinoErrorScreen(this.error, {super.key});
/// The exception to be displayed.
final Exception? error;
diff --git a/packages/go_router/lib/src/pages/custom_transition_page.dart b/packages/go_router/lib/src/pages/custom_transition_page.dart
index ab0c8e5..431df30 100644
--- a/packages/go_router/lib/src/pages/custom_transition_page.dart
+++ b/packages/go_router/lib/src/pages/custom_transition_page.dart
@@ -23,16 +23,11 @@
this.barrierDismissible = false,
this.barrierColor,
this.barrierLabel,
- LocalKey? key,
- String? name,
- Object? arguments,
- String? restorationId,
- }) : super(
- key: key,
- name: name,
- arguments: arguments,
- restorationId: restorationId,
- );
+ super.key,
+ super.name,
+ super.arguments,
+ super.restorationId,
+ });
/// The content to be shown in the Route created by this page.
final Widget child;
@@ -160,19 +155,14 @@
class NoTransitionPage<T> extends CustomTransitionPage<T> {
/// Constructor for a page with no transition functionality.
const NoTransitionPage({
- required Widget child,
- String? name,
- Object? arguments,
- String? restorationId,
- LocalKey? key,
+ required super.child,
+ super.name,
+ super.arguments,
+ super.restorationId,
+ super.key,
}) : super(
transitionsBuilder: _transitionsBuilder,
- transitionDuration: const Duration(microseconds: 1), // hack for #205
- key: key,
- name: name,
- arguments: arguments,
- restorationId: restorationId,
- child: child,
+ transitionDuration: const Duration(microseconds: 1),
);
static Widget _transitionsBuilder(
diff --git a/packages/go_router/lib/src/pages/material.dart b/packages/go_router/lib/src/pages/material.dart
index 3eb656b..ae56763 100644
--- a/packages/go_router/lib/src/pages/material.dart
+++ b/packages/go_router/lib/src/pages/material.dart
@@ -31,7 +31,7 @@
/// Default error page implementation for Material.
class MaterialErrorScreen extends StatelessWidget {
/// Provide an exception to this page for it to be displayed.
- const MaterialErrorScreen(this.error, {Key? key}) : super(key: key);
+ const MaterialErrorScreen(this.error, {super.key});
/// The exception to be displayed.
final Exception? error;
diff --git a/packages/go_router/lib/src/path_utils.dart b/packages/go_router/lib/src/path_utils.dart
index b10a6cc..804e0ee 100644
--- a/packages/go_router/lib/src/path_utils.dart
+++ b/packages/go_router/lib/src/path_utils.dart
@@ -66,7 +66,7 @@
/// 2. Call [patternToPath] with the `pathParameters` from the first step and
/// the original `pattern` used for generating the [RegExp].
String patternToPath(String pattern, Map<String, String> pathParameters) {
- final StringBuffer buffer = StringBuffer('');
+ final StringBuffer buffer = StringBuffer();
int start = 0;
for (final RegExpMatch match in _parameterRegExp.allMatches(pattern)) {
if (match.start > start) {
diff --git a/packages/go_router/lib/src/redirection.dart b/packages/go_router/lib/src/redirection.dart
index 400ef8b..0abeb52 100644
--- a/packages/go_router/lib/src/redirection.dart
+++ b/packages/go_router/lib/src/redirection.dart
@@ -111,13 +111,10 @@
final Uri location;
@override
- String toString() =>
- super.toString() +
- ' ' +
- <String>[
+ String toString() => '${super.toString()} ${<String>[
...matches.map(
(RouteMatchList routeMatches) => routeMatches.location.toString()),
- ].join(' => ');
+ ].join(' => ')}';
}
/// Adds the redirect to [redirects] if it is valid.
diff --git a/packages/go_router/lib/src/route_data.dart b/packages/go_router/lib/src/route_data.dart
index 0f9f7b5..ec15085 100644
--- a/packages/go_router/lib/src/route_data.dart
+++ b/packages/go_router/lib/src/route_data.dart
@@ -55,7 +55,7 @@
.replace(
queryParameters:
// Avoid `?` in generated location if `queryParams` is empty
- queryParams?.isNotEmpty == true ? queryParams : null,
+ queryParams?.isNotEmpty ?? false ? queryParams : null,
)
.toString();
diff --git a/packages/go_router/pubspec.yaml b/packages/go_router/pubspec.yaml
index 44cda90..2a54b88 100644
--- a/packages/go_router/pubspec.yaml
+++ b/packages/go_router/pubspec.yaml
@@ -1,7 +1,7 @@
name: go_router
description: A declarative router for Flutter based on Navigation 2 supporting
deep linking, data-driven routes and more
-version: 4.2.8
+version: 4.2.9
repository: https://github.com/flutter/packages/tree/main/packages/go_router
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+go_router%22
diff --git a/packages/go_router/test/cupertino_test.dart b/packages/go_router/test/cupertino_test.dart
index 4413d6a..323aea3 100644
--- a/packages/go_router/test/cupertino_test.dart
+++ b/packages/go_router/test/cupertino_test.dart
@@ -93,7 +93,7 @@
}
class DummyStatefulWidget extends StatefulWidget {
- const DummyStatefulWidget({Key? key}) : super(key: key);
+ const DummyStatefulWidget({super.key});
@override
State<DummyStatefulWidget> createState() => _DummyStatefulWidgetState();
diff --git a/packages/go_router/test/custom_transition_page_test.dart b/packages/go_router/test/custom_transition_page_test.dart
index 28c622a..5845be6 100644
--- a/packages/go_router/test/custom_transition_page_test.dart
+++ b/packages/go_router/test/custom_transition_page_test.dart
@@ -89,7 +89,7 @@
}
class HomeScreen extends StatelessWidget {
- const HomeScreen({Key? key}) : super(key: key);
+ const HomeScreen({super.key});
@override
Widget build(BuildContext context) {
@@ -102,7 +102,7 @@
}
class LoginScreen extends StatelessWidget {
- const LoginScreen({Key? key}) : super(key: key);
+ const LoginScreen({super.key});
@override
Widget build(BuildContext context) {
diff --git a/packages/go_router/test/delegate_test.dart b/packages/go_router/test/delegate_test.dart
index b4a4173..75025a9 100644
--- a/packages/go_router/test/delegate_test.dart
+++ b/packages/go_router/test/delegate_test.dart
@@ -241,7 +241,7 @@
}
class DummyStatefulWidget extends StatefulWidget {
- const DummyStatefulWidget({Key? key}) : super(key: key);
+ const DummyStatefulWidget({super.key});
@override
State<DummyStatefulWidget> createState() => _DummyStatefulWidgetState();
diff --git a/packages/go_router/test/error_page_test.dart b/packages/go_router/test/error_page_test.dart
index 5028dcc..071cc96 100644
--- a/packages/go_router/test/error_page_test.dart
+++ b/packages/go_router/test/error_page_test.dart
@@ -53,7 +53,7 @@
}
class DummyStatefulWidget extends StatefulWidget {
- const DummyStatefulWidget({Key? key}) : super(key: key);
+ const DummyStatefulWidget({super.key});
@override
State<DummyStatefulWidget> createState() => _DummyStatefulWidgetState();
diff --git a/packages/go_router/test/go_router_test.dart b/packages/go_router/test/go_router_test.dart
index 5758a58..e1b4000 100644
--- a/packages/go_router/test/go_router_test.dart
+++ b/packages/go_router/test/go_router_test.dart
@@ -19,8 +19,9 @@
final Logger log = Logger('GoRouter tests');
void main() {
- if (enableLogs)
+ if (enableLogs) {
Logger.root.onRecord.listen((LogRecord e) => debugPrint('$e'));
+ }
group('path routes', () {
testWidgets('match home route', (WidgetTester tester) async {
@@ -178,7 +179,6 @@
final GoRouter router = await createRouter(routes, tester);
router.go('/login/');
final List<RouteMatch> matches = router.routerDelegate.matches.matches;
- print(matches);
expect(matches, hasLength(1));
expect(matches.first.subloc, '/login');
expect(router.screenFor(matches.first).runtimeType, LoginScreen);
@@ -1290,7 +1290,6 @@
final GoRouter router = await createRouter(
routes,
tester,
- initialLocation: '/',
);
expect(router.routeInformationProvider.value.location, '/dummy');
TestWidgetsFlutterBinding
diff --git a/packages/go_router/test/inherited_test.dart b/packages/go_router/test/inherited_test.dart
index 216b93c..2592eed 100644
--- a/packages/go_router/test/inherited_test.dart
+++ b/packages/go_router/test/inherited_test.dart
@@ -71,7 +71,7 @@
expect(properties.properties.first.value, goRouter);
});
- testWidgets('mediates Widget\'s access to GoRouter.',
+ testWidgets("mediates Widget's access to GoRouter.",
(WidgetTester tester) async {
final MockGoRouter router = MockGoRouter();
await tester.pumpWidget(MaterialApp(
@@ -99,21 +99,21 @@
}
class Page1 extends StatelessWidget {
- const Page1({Key? key}) : super(key: key);
+ const Page1({super.key});
@override
Widget build(BuildContext context) => Container();
}
class Page2 extends StatelessWidget {
- const Page2({Key? key}) : super(key: key);
+ const Page2({super.key});
@override
Widget build(BuildContext context) => Container();
}
class _MyWidget extends StatelessWidget {
- const _MyWidget({Key? key}) : super(key: key);
+ const _MyWidget();
@override
Widget build(BuildContext context) {
diff --git a/packages/go_router/test/logging_test.dart b/packages/go_router/test/logging_test.dart
index 585ccc0..5273660 100644
--- a/packages/go_router/test/logging_test.dart
+++ b/packages/go_router/test/logging_test.dart
@@ -9,11 +9,10 @@
void main() {
// Reset the logger before each test.
setUp(() {
- setLogging(enabled: false);
+ setLogging();
});
test('setLogging enables log messages on the logger', () {
- log.onRecord
- .listen(expectAsync1<void, LogRecord>((LogRecord r) {}, count: 1));
+ log.onRecord.listen(expectAsync1<void, LogRecord>((LogRecord r) {}));
setLogging(enabled: true);
log.info('message');
@@ -23,7 +22,7 @@
log.onRecord
.listen(expectAsync1<void, LogRecord>((LogRecord r) {}, count: 0));
- setLogging(enabled: false);
+ setLogging();
log.info('message');
});
}
diff --git a/packages/go_router/test/material_test.dart b/packages/go_router/test/material_test.dart
index 15e4ee0..4da273e 100644
--- a/packages/go_router/test/material_test.dart
+++ b/packages/go_router/test/material_test.dart
@@ -92,7 +92,7 @@
}
class DummyStatefulWidget extends StatefulWidget {
- const DummyStatefulWidget({Key? key}) : super(key: key);
+ const DummyStatefulWidget({super.key});
@override
State<DummyStatefulWidget> createState() => _DummyStatefulWidgetState();
diff --git a/packages/go_router/test/parser_test.dart b/packages/go_router/test/parser_test.dart
index 8d119b2dc..b943f12 100644
--- a/packages/go_router/test/parser_test.dart
+++ b/packages/go_router/test/parser_test.dart
@@ -100,10 +100,7 @@
expect(configuration.namedLocation('SNAKE_CASE'), '/hij');
// With query parameters
- expect(
- configuration
- .namedLocation('lowercase', queryParams: const <String, String>{}),
- '/abc');
+ expect(configuration.namedLocation('lowercase'), '/abc');
expect(
configuration.namedLocation('lowercase',
queryParams: const <String, String>{'q': '1'}),
diff --git a/packages/go_router/test/path_utils_test.dart b/packages/go_router/test/path_utils_test.dart
index 5c519e0..1c883c4 100644
--- a/packages/go_router/test/path_utils_test.dart
+++ b/packages/go_router/test/path_utils_test.dart
@@ -74,32 +74,32 @@
});
test('concatenatePaths', () {
- void _verify(String pathA, String pathB, String expected) {
+ void verify(String pathA, String pathB, String expected) {
final String result = concatenatePaths(pathA, pathB);
expect(result, expected);
}
- void _verifyThrows(String pathA, String pathB) {
+ void verifyThrows(String pathA, String pathB) {
expect(
() => concatenatePaths(pathA, pathB), throwsA(isA<AssertionError>()));
}
- _verify('/a', 'b/c', '/a/b/c');
- _verify('/', 'b', '/b');
- _verifyThrows('/a', '/b');
- _verifyThrows('/a', '/');
- _verifyThrows('/', '/');
- _verifyThrows('/', '');
- _verifyThrows('', '');
+ verify('/a', 'b/c', '/a/b/c');
+ verify('/', 'b', '/b');
+ verifyThrows('/a', '/b');
+ verifyThrows('/a', '/');
+ verifyThrows('/', '/');
+ verifyThrows('/', '');
+ verifyThrows('', '');
});
test('canonicalUri', () {
- void _verify(String path, String expected) =>
+ void verify(String path, String expected) =>
expect(canonicalUri(path), expected);
- _verify('/a', '/a');
- _verify('/a/', '/a');
- _verify('/', '/');
- _verify('/a/b/', '/a/b');
+ verify('/a', '/a');
+ verify('/a/', '/a');
+ verify('/', '/');
+ verify('/a/b/', '/a/b');
expect(() => canonicalUri('::::'), throwsA(isA<FormatException>()));
expect(() => canonicalUri(''), throwsA(anything));
diff --git a/packages/go_router/test/test_helpers.dart b/packages/go_router/test/test_helpers.dart
index 5361cef..f0592a6 100644
--- a/packages/go_router/test/test_helpers.dart
+++ b/packages/go_router/test/test_helpers.dart
@@ -4,8 +4,6 @@
// ignore_for_file: cascade_invocations, diagnostic_describe_all_properties
-import 'dart:async';
-
import 'package:flutter/material.dart';
import 'package:flutter/src/foundation/diagnostics.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -43,8 +41,7 @@
child;
class GoRouterNamedLocationSpy extends GoRouter {
- GoRouterNamedLocationSpy({required List<GoRoute> routes})
- : super(routes: routes);
+ GoRouterNamedLocationSpy({required super.routes});
String? name;
Map<String, String>? params;
@@ -64,7 +61,7 @@
}
class GoRouterGoSpy extends GoRouter {
- GoRouterGoSpy({required List<GoRoute> routes}) : super(routes: routes);
+ GoRouterGoSpy({required super.routes});
String? myLocation;
Object? extra;
@@ -77,7 +74,7 @@
}
class GoRouterGoNamedSpy extends GoRouter {
- GoRouterGoNamedSpy({required List<GoRoute> routes}) : super(routes: routes);
+ GoRouterGoNamedSpy({required super.routes});
String? name;
Map<String, String>? params;
@@ -99,7 +96,7 @@
}
class GoRouterPushSpy extends GoRouter {
- GoRouterPushSpy({required List<GoRoute> routes}) : super(routes: routes);
+ GoRouterPushSpy({required super.routes});
String? myLocation;
Object? extra;
@@ -112,7 +109,7 @@
}
class GoRouterPushNamedSpy extends GoRouter {
- GoRouterPushNamedSpy({required List<GoRoute> routes}) : super(routes: routes);
+ GoRouterPushNamedSpy({required super.routes});
String? name;
Map<String, String>? params;
@@ -134,7 +131,7 @@
}
class GoRouterPopSpy extends GoRouter {
- GoRouterPopSpy({required List<GoRoute> routes}) : super(routes: routes);
+ GoRouterPopSpy({required super.routes});
bool popped = false;
@@ -146,9 +143,8 @@
class GoRouterRefreshStreamSpy extends GoRouterRefreshStream {
GoRouterRefreshStreamSpy(
- Stream<dynamic> stream,
- ) : notifyCount = 0,
- super(stream);
+ super.stream,
+ ) : notifyCount = 0;
late int notifyCount;
@@ -173,7 +169,6 @@
redirectLimit: redirectLimit,
errorBuilder: (BuildContext context, GoRouterState state) =>
TestErrorScreen(state.error!),
- debugLogDiagnostics: false,
);
await tester.pumpWidget(
MaterialApp.router(
@@ -186,44 +181,44 @@
}
class TestErrorScreen extends DummyScreen {
- const TestErrorScreen(this.ex, {Key? key}) : super(key: key);
+ const TestErrorScreen(this.ex, {super.key});
final Exception ex;
}
class HomeScreen extends DummyScreen {
- const HomeScreen({Key? key}) : super(key: key);
+ const HomeScreen({super.key});
}
class Page1Screen extends DummyScreen {
- const Page1Screen({Key? key}) : super(key: key);
+ const Page1Screen({super.key});
}
class Page2Screen extends DummyScreen {
- const Page2Screen({Key? key}) : super(key: key);
+ const Page2Screen({super.key});
}
class LoginScreen extends DummyScreen {
- const LoginScreen({Key? key}) : super(key: key);
+ const LoginScreen({super.key});
}
class FamilyScreen extends DummyScreen {
- const FamilyScreen(this.fid, {Key? key}) : super(key: key);
+ const FamilyScreen(this.fid, {super.key});
final String fid;
}
class FamiliesScreen extends DummyScreen {
- const FamiliesScreen({required this.selectedFid, Key? key}) : super(key: key);
+ const FamiliesScreen({required this.selectedFid, super.key});
final String selectedFid;
}
class PersonScreen extends DummyScreen {
- const PersonScreen(this.fid, this.pid, {Key? key}) : super(key: key);
+ const PersonScreen(this.fid, this.pid, {super.key});
final String fid;
final String pid;
}
class DummyScreen extends StatelessWidget {
- const DummyScreen({Key? key}) : super(key: key);
+ const DummyScreen({super.key});
@override
Widget build(BuildContext context) => const Placeholder();
@@ -336,7 +331,7 @@
}
class DummyStatefulWidget extends StatefulWidget {
- const DummyStatefulWidget({Key? key}) : super(key: key);
+ const DummyStatefulWidget({super.key});
@override
State<DummyStatefulWidget> createState() => DummyStatefulWidgetState();
diff --git a/packages/go_router_builder/CHANGELOG.md b/packages/go_router_builder/CHANGELOG.md
index fe290f8..c8033e6 100644
--- a/packages/go_router_builder/CHANGELOG.md
+++ b/packages/go_router_builder/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.0.9
+
+* Fixes lint warnings.
+
## 1.0.8
* Updates `analyzer` to 4.4.0.
diff --git a/packages/go_router_builder/lib/src/route_config.dart b/packages/go_router_builder/lib/src/route_config.dart
index 47e1b52..49ebc5d 100644
--- a/packages/go_router_builder/lib/src/route_config.dart
+++ b/packages/go_router_builder/lib/src/route_config.dart
@@ -219,7 +219,7 @@
'Token ($e) of type ${e.runtimeType} is not supported.',
);
});
- return "'${pathItems.join('')}'";
+ return "'${pathItems.join()}'";
}
late final Set<String> _pathParams = Set<String>.unmodifiable(_parsedPath
@@ -249,7 +249,7 @@
final String routesBit = _children.isEmpty
? ''
: '''
-routes: [${_children.map((RouteConfig e) => '${e._routeDefinition()},').join('')}],
+routes: [${_children.map((RouteConfig e) => '${e._routeDefinition()},').join()}],
''';
return '''
diff --git a/packages/go_router_builder/pubspec.yaml b/packages/go_router_builder/pubspec.yaml
index 420e0a9..a466ea1 100644
--- a/packages/go_router_builder/pubspec.yaml
+++ b/packages/go_router_builder/pubspec.yaml
@@ -2,7 +2,7 @@
description: >-
A builder that supports generated strongly-typed route helpers for
package:go_router
-version: 1.0.8
+version: 1.0.9
repository: https://github.com/flutter/packages/tree/main/packages/go_router_builder
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+go_router_builder%22
diff --git a/packages/imitation_game/CHANGELOG.md b/packages/imitation_game/CHANGELOG.md
index 9a0072c..5487796 100644
--- a/packages/imitation_game/CHANGELOG.md
+++ b/packages/imitation_game/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.0.2+1
+
+* Fixes lint warnings.
+
## 0.0.2
* Migrate to null safety.
diff --git a/packages/imitation_game/bin/imitation_game.dart b/packages/imitation_game/bin/imitation_game.dart
index 175a20d..26d535b 100644
--- a/packages/imitation_game/bin/imitation_game.dart
+++ b/packages/imitation_game/bin/imitation_game.dart
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// ignore_for_file: avoid_print, avoid_dynamic_calls
+
import 'dart:async';
import 'dart:convert';
import 'dart:io';
diff --git a/packages/imitation_game/imitation_tests/smiley/flutter/smiley/lib/main.dart b/packages/imitation_game/imitation_tests/smiley/flutter/smiley/lib/main.dart
index 5de3137..627dd5a 100644
--- a/packages/imitation_game/imitation_tests/smiley/flutter/smiley/lib/main.dart
+++ b/packages/imitation_game/imitation_tests/smiley/flutter/smiley/lib/main.dart
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// ignore_for_file: avoid_print
+
import 'dart:convert' show jsonEncode;
import 'dart:io';
@@ -73,7 +75,7 @@
const MyHomePage({Key key}) : super(key: key);
@override
- _MyHomePageState createState() => _MyHomePageState();
+ State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@@ -83,7 +85,7 @@
@override
void initState() {
_image
- .resolve(const ImageConfiguration())
+ .resolve(ImageConfiguration.empty)
.addListener(ImageStreamListener((_, __) {
if (mounted) {
setState(() {
@@ -91,8 +93,8 @@
// This should get called when the image has actually been drawn to the screen.
WidgetsBinding.instance.addPostFrameCallback((_) async {
final DateTime renderTime = DateTime.now();
- final PollIosStats _poller = PollIosStats();
- final StartupTime startupTime = await _poller.pollStartupTime();
+ final PollIosStats poller = PollIosStats();
+ final StartupTime startupTime = await poller.pollStartupTime();
final Duration diff = renderTime.difference(
DateTime.fromMicrosecondsSinceEpoch(startupTime.startupTime));
_sendResult(diff.inMicroseconds / 1000000.0);
diff --git a/packages/imitation_game/pubspec.yaml b/packages/imitation_game/pubspec.yaml
index 38ae95c..3b10ce6 100644
--- a/packages/imitation_game/pubspec.yaml
+++ b/packages/imitation_game/pubspec.yaml
@@ -2,7 +2,7 @@
description: Testing framework for comparing multiple frameworks' performance.
repository: https://github.com/flutter/packages/tree/main/packages/imitation_game
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+imitation_game%22
-version: 0.0.2
+version: 0.0.2+1
environment:
sdk: '>=2.12.0 <3.0.0'
diff --git a/packages/metrics_center/CHANGELOG.md b/packages/metrics_center/CHANGELOG.md
index ec99e05..6628b71 100644
--- a/packages/metrics_center/CHANGELOG.md
+++ b/packages/metrics_center/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.0.6
+
+- Fixes lint warnings.
+
## 1.0.5
- Fix JSON parsing issue when running in sound null-safety mode.
diff --git a/packages/metrics_center/lib/src/gcs_lock.dart b/packages/metrics_center/lib/src/gcs_lock.dart
index ca64f64..5e6b2df 100644
--- a/packages/metrics_center/lib/src/gcs_lock.dart
+++ b/packages/metrics_center/lib/src/gcs_lock.dart
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// ignore_for_file: avoid_print
+
import 'package:googleapis/storage/v1.dart';
import 'package:googleapis_auth/googleapis_auth.dart';
diff --git a/packages/metrics_center/lib/src/google_benchmark.dart b/packages/metrics_center/lib/src/google_benchmark.dart
index feb1f36..90ddef7 100644
--- a/packages/metrics_center/lib/src/google_benchmark.dart
+++ b/packages/metrics_center/lib/src/google_benchmark.dart
@@ -74,8 +74,9 @@
try {
rawValue = item[subResult] as num?;
} catch (e) {
+ // ignore: avoid_print
print(
- '$subResult: ${item[subResult]} (${item[subResult].runtimeType}) is not a number');
+ '$subResult: ${item[subResult]} (${(item[subResult] as Object?).runtimeType}) is not a number');
rethrow;
}
diff --git a/packages/metrics_center/lib/src/skiaperf.dart b/packages/metrics_center/lib/src/skiaperf.dart
index 01f5ed9..1e30e63 100644
--- a/packages/metrics_center/lib/src/skiaperf.dart
+++ b/packages/metrics_center/lib/src/skiaperf.dart
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// ignore_for_file: avoid_dynamic_calls
+
import 'dart:convert';
import 'package:gcloud/storage.dart';
@@ -82,8 +84,9 @@
final String? name = p.tags[kNameKey];
if (githubRepo == null || gitHash == null || name == null) {
- throw '$kGithubRepoKey, $kGitRevisionKey, $kNameKey must be set in'
- ' the tags of $p.';
+ throw StateError(
+ '$kGithubRepoKey, $kGitRevisionKey, $kNameKey must be set in'
+ ' the tags of $p.');
}
final String subResult = p.tags[kSubResultKey] ?? kSkiaPerfValueKey;
@@ -382,7 +385,7 @@
final Storage storage = Storage(client, projectId);
final String bucketName = isTesting ? kTestBucketName : kBucketName;
if (!await storage.bucketExists(bucketName)) {
- throw 'Bucket $bucketName does not exist.';
+ throw StateError('Bucket $bucketName does not exist.');
}
final SkiaPerfGcsAdaptor adaptor =
SkiaPerfGcsAdaptor(storage.bucket(bucketName));
diff --git a/packages/metrics_center/pubspec.yaml b/packages/metrics_center/pubspec.yaml
index 617eadd..874d837 100644
--- a/packages/metrics_center/pubspec.yaml
+++ b/packages/metrics_center/pubspec.yaml
@@ -1,5 +1,5 @@
name: metrics_center
-version: 1.0.5
+version: 1.0.6
description:
Support multiple performance metrics sources/formats and destinations.
repository: https://github.com/flutter/packages/tree/main/packages/metrics_center
diff --git a/packages/metrics_center/test/common.dart b/packages/metrics_center/test/common.dart
index 07f2f6f..bab9663 100644
--- a/packages/metrics_center/test/common.dart
+++ b/packages/metrics_center/test/common.dart
@@ -22,6 +22,8 @@
try {
directory.deleteSync(recursive: true);
} on FileSystemException catch (error) {
+ // TODO(goderbauer): We should not be printing from a test util function.
+ // ignore: avoid_print
print('Failed to delete ${directory.path}: $error');
}
}
diff --git a/packages/metrics_center/test/gcs_lock_test.dart b/packages/metrics_center/test/gcs_lock_test.dart
index b5228bf..bc84ac1 100644
--- a/packages/metrics_center/test/gcs_lock_test.dart
+++ b/packages/metrics_center/test/gcs_lock_test.dart
@@ -45,6 +45,8 @@
runFinished.catchError((dynamic e) {
final AssertionError error = e as AssertionError;
expect(error.message, 'Stop!');
+ // TODO(goderbauer): We should not be printing from a test.
+ // ignore: avoid_print
print('${error.message}');
});
fakeAsync.elapse(const Duration(seconds: 20));
diff --git a/packages/multicast_dns/CHANGELOG.md b/packages/multicast_dns/CHANGELOG.md
index a20e590..76837a4 100644
--- a/packages/multicast_dns/CHANGELOG.md
+++ b/packages/multicast_dns/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.3.2+2
+
+* Fixes lints warnings.
+
## 0.3.2+1
* Migrates from `ui.hash*` to `Object.hash*`.
diff --git a/packages/multicast_dns/example/main.dart b/packages/multicast_dns/example/main.dart
index 588bcb2..2fdb57a 100644
--- a/packages/multicast_dns/example/main.dart
+++ b/packages/multicast_dns/example/main.dart
@@ -5,6 +5,8 @@
// Example script to illustrate how to use the mdns package to discover the port
// of a Dart observatory over mDNS.
+// ignore_for_file: avoid_print
+
import 'package:multicast_dns/multicast_dns.dart';
Future<void> main() async {
diff --git a/packages/multicast_dns/example/mdns_resolve.dart b/packages/multicast_dns/example/mdns_resolve.dart
index a7c35a8..5246997 100644
--- a/packages/multicast_dns/example/mdns_resolve.dart
+++ b/packages/multicast_dns/example/mdns_resolve.dart
@@ -5,6 +5,8 @@
// Example script to illustrate how to use the mdns package to lookup names
// on the local network.
+// ignore_for_file: avoid_print
+
import 'package:multicast_dns/multicast_dns.dart';
Future<void> main(List<String> args) async {
diff --git a/packages/multicast_dns/example/mdns_sd.dart b/packages/multicast_dns/example/mdns_sd.dart
index 5b5fb6e..50b46eb 100644
--- a/packages/multicast_dns/example/mdns_sd.dart
+++ b/packages/multicast_dns/example/mdns_sd.dart
@@ -5,6 +5,8 @@
// Example script to illustrate how to use the mdns package to discover services
// on the local network.
+// ignore_for_file: avoid_print
+
import 'package:multicast_dns/multicast_dns.dart';
Future<void> main(List<String> args) async {
diff --git a/packages/multicast_dns/lib/multicast_dns.dart b/packages/multicast_dns/lib/multicast_dns.dart
index 5aeeab4..336ac42 100644
--- a/packages/multicast_dns/lib/multicast_dns.dart
+++ b/packages/multicast_dns/lib/multicast_dns.dart
@@ -5,11 +5,11 @@
import 'dart:async';
import 'dart:io';
-import 'package:multicast_dns/src/constants.dart';
-import 'package:multicast_dns/src/lookup_resolver.dart';
-import 'package:multicast_dns/src/native_protocol_client.dart';
-import 'package:multicast_dns/src/packet.dart';
-import 'package:multicast_dns/src/resource_record.dart';
+import 'src/constants.dart';
+import 'src/lookup_resolver.dart';
+import 'src/native_protocol_client.dart';
+import 'src/packet.dart';
+import 'src/resource_record.dart';
export 'package:multicast_dns/src/resource_record.dart';
diff --git a/packages/multicast_dns/lib/src/lookup_resolver.dart b/packages/multicast_dns/lib/src/lookup_resolver.dart
index 6f2eea7..addae7d 100644
--- a/packages/multicast_dns/lib/src/lookup_resolver.dart
+++ b/packages/multicast_dns/lib/src/lookup_resolver.dart
@@ -5,7 +5,7 @@
import 'dart:async';
import 'dart:collection';
-import 'package:multicast_dns/src/resource_record.dart';
+import 'resource_record.dart';
/// Class for maintaining state about pending mDNS requests.
class PendingRequest extends LinkedListEntry<PendingRequest> {
diff --git a/packages/multicast_dns/lib/src/native_protocol_client.dart b/packages/multicast_dns/lib/src/native_protocol_client.dart
index aa2eb5c..b754519 100644
--- a/packages/multicast_dns/lib/src/native_protocol_client.dart
+++ b/packages/multicast_dns/lib/src/native_protocol_client.dart
@@ -4,7 +4,7 @@
import 'dart:collection';
-import 'package:multicast_dns/src/resource_record.dart';
+import 'resource_record.dart';
/// Cache for resource records that have been received.
///
diff --git a/packages/multicast_dns/lib/src/packet.dart b/packages/multicast_dns/lib/src/packet.dart
index 514cd14..dcf1402 100644
--- a/packages/multicast_dns/lib/src/packet.dart
+++ b/packages/multicast_dns/lib/src/packet.dart
@@ -6,8 +6,8 @@
import 'dart:io';
import 'dart:typed_data';
-import 'package:multicast_dns/src/constants.dart';
-import 'package:multicast_dns/src/resource_record.dart';
+import 'constants.dart';
+import 'resource_record.dart';
// Offsets into the header. See https://tools.ietf.org/html/rfc1035.
const int _kIdOffset = 0;
diff --git a/packages/multicast_dns/lib/src/resource_record.dart b/packages/multicast_dns/lib/src/resource_record.dart
index 46e5731..65320d5 100644
--- a/packages/multicast_dns/lib/src/resource_record.dart
+++ b/packages/multicast_dns/lib/src/resource_record.dart
@@ -7,8 +7,8 @@
import 'dart:typed_data';
import 'package:meta/meta.dart';
-import 'package:multicast_dns/src/constants.dart';
-import 'package:multicast_dns/src/packet.dart';
+import 'constants.dart';
+import 'packet.dart';
/// Enumeration of support resource record types.
abstract class ResourceRecordType {
diff --git a/packages/multicast_dns/pubspec.yaml b/packages/multicast_dns/pubspec.yaml
index c43df34..04ed3aa 100644
--- a/packages/multicast_dns/pubspec.yaml
+++ b/packages/multicast_dns/pubspec.yaml
@@ -2,7 +2,7 @@
description: Dart package for performing mDNS queries (e.g. Bonjour, Avahi).
repository: https://github.com/flutter/packages/tree/main/packages/multicast_dns
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+multicast_dns%22
-version: 0.3.2+1
+version: 0.3.2+2
environment:
sdk: ">=2.14.0 <3.0.0"
diff --git a/packages/multicast_dns/test/decode_test.dart b/packages/multicast_dns/test/decode_test.dart
index 442d599..32d7c2f 100644
--- a/packages/multicast_dns/test/decode_test.dart
+++ b/packages/multicast_dns/test/decode_test.dart
@@ -178,7 +178,7 @@
TxtResourceRecord(
'______________________.____________.____._____',
result[1].validUntil,
- text: (')' * 129) + '\n',
+ text: '${')' * 129}\n',
),
]);
});
diff --git a/packages/multicast_dns/tool/packet_gen.dart b/packages/multicast_dns/tool/packet_gen.dart
index 4845b16..6e1e278 100644
--- a/packages/multicast_dns/tool/packet_gen.dart
+++ b/packages/multicast_dns/tool/packet_gen.dart
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// ignore_for_file: avoid_print
+
// Support code to generate the hex-lists in test/decode_test.dart from
// a hex-stream.
import 'dart:io';
@@ -51,7 +53,7 @@
}
void dumpDatagram(Datagram datagram) {
- String _toHex(List<int> ints) {
+ String toHex(List<int> ints) {
final StringBuffer buffer = StringBuffer();
for (int i = 0; i < ints.length; i++) {
buffer.write(ints[i].toRadixString(16).padLeft(2, '0'));
@@ -65,6 +67,6 @@
}
print('${datagram.address.address}:${datagram.port}:');
- print(_toHex(datagram.data));
+ print(toHex(datagram.data));
print('');
}
diff --git a/packages/palette_generator/CHANGELOG.md b/packages/palette_generator/CHANGELOG.md
index 0e5193c..9475317 100644
--- a/packages/palette_generator/CHANGELOG.md
+++ b/packages/palette_generator/CHANGELOG.md
@@ -1,7 +1,8 @@
-## NEXT
+## 0.3.3+2
* Ignores lint warnings from new changes in Flutter master.
* Suppresses deprecation warnings for changes to Flutter master.
+* Fixes lint warnings.
## 0.3.3+1
diff --git a/packages/palette_generator/example/lib/main.dart b/packages/palette_generator/example/lib/main.dart
index 33bfbf4..94fd962 100644
--- a/packages/palette_generator/example/lib/main.dart
+++ b/packages/palette_generator/example/lib/main.dart
@@ -59,7 +59,7 @@
final Size? imageSize;
@override
- _ImageColorsState createState() {
+ State<ImageColors> createState() {
return _ImageColorsState();
}
}
@@ -149,9 +149,6 @@
title: Text(widget.title ?? ''),
),
body: Column(
- mainAxisSize: MainAxisSize.max,
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(20.0),
@@ -175,9 +172,7 @@
decoration: BoxDecoration(
color: _kSelectionRectangleBackground,
border: Border.all(
- width: 1.0,
color: _kSelectionRectangleBorder,
- style: BorderStyle.solid,
)),
)),
]),
@@ -218,7 +213,6 @@
return Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Wrap(
children: swatches,
@@ -280,13 +274,11 @@
fallbackWidth: 34.0,
fallbackHeight: 20.0,
color: Color(0xff404040),
- strokeWidth: 2.0,
)
: Container(
decoration: BoxDecoration(
color: color,
border: Border.all(
- width: 1.0,
color: _kPlaceholderColor,
style: colorDistance < 0.2
? BorderStyle.solid
@@ -301,7 +293,6 @@
swatch = ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 130.0, minWidth: 130.0),
child: Row(
- mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
swatch,
Container(width: 5.0),
diff --git a/packages/palette_generator/lib/palette_generator.dart b/packages/palette_generator/lib/palette_generator.dart
index 4f56e20..3619773 100644
--- a/packages/palette_generator/lib/palette_generator.dart
+++ b/packages/palette_generator/lib/palette_generator.dart
@@ -15,7 +15,7 @@
import 'dart:ui' show Color, ImageByteFormat;
import 'package:collection/collection.dart'
- show PriorityQueue, HeapPriorityQueue;
+ show HeapPriorityQueue, PriorityQueue;
import 'package:flutter/foundation.dart';
import 'package:flutter/painting.dart';
@@ -192,10 +192,9 @@
],
List<PaletteTarget> targets = const <PaletteTarget>[],
}) async {
- final ByteData? imageData =
- await image.toByteData(format: ui.ImageByteFormat.rawRgba);
+ final ByteData? imageData = await image.toByteData();
if (imageData == null) {
- throw 'Failed to encode the image.';
+ throw StateError('Failed to encode the image.');
}
return PaletteGenerator.fromByteData(
@@ -518,7 +517,6 @@
static const double _targetLightLightness = 0.74;
static const double _minNormalLightness = 0.3;
- static const double _targetNormalLightness = 0.5;
static const double _maxNormalLightness = 0.7;
static const double _targetMutedSaturation = 0.3;
@@ -548,7 +546,6 @@
/// One of the base set of `targets` for [PaletteGenerator.fromImage], in [baseTargets].
static final PaletteTarget vibrant = PaletteTarget(
minimumLightness: _minNormalLightness,
- targetLightness: _targetNormalLightness,
maximumLightness: _maxNormalLightness,
minimumSaturation: _minVibrantSaturation,
targetSaturation: _targetVibrantSaturation,
@@ -582,7 +579,6 @@
/// One of the base set of `targets` for [PaletteGenerator.fromImage], in [baseTargets].
static final PaletteTarget muted = PaletteTarget(
minimumLightness: _minNormalLightness,
- targetLightness: _targetNormalLightness,
maximumLightness: _maxNormalLightness,
targetSaturation: _targetMutedSaturation,
maximumSaturation: _maxMutedSaturation,
@@ -883,18 +879,18 @@
/// See also:
/// * [PaletteGenerator], a class for selecting color palettes from images.
bool avoidRedBlackWhitePaletteFilter(HSLColor color) {
- bool _isBlack(HSLColor hslColor) {
- const double _blackMaxLightness = 0.05;
- return hslColor.lightness <= _blackMaxLightness;
+ bool isBlack(HSLColor hslColor) {
+ const double blackMaxLightness = 0.05;
+ return hslColor.lightness <= blackMaxLightness;
}
- bool _isWhite(HSLColor hslColor) {
- const double _whiteMinLightness = 0.95;
- return hslColor.lightness >= _whiteMinLightness;
+ bool isWhite(HSLColor hslColor) {
+ const double whiteMinLightness = 0.95;
+ return hslColor.lightness >= whiteMinLightness;
}
// Returns true if the color is close to the red side of the I line.
- bool _isNearRedILine(HSLColor hslColor) {
+ bool isNearRedILine(HSLColor hslColor) {
const double redLineMinHue = 10.0;
const double redLineMaxHue = 37.0;
const double redLineMaxSaturation = 0.82;
@@ -903,7 +899,7 @@
hslColor.saturation <= redLineMaxSaturation;
}
- return !_isWhite(color) && !_isBlack(color) && !_isNearRedILine(color);
+ return !isWhite(color) && !isBlack(color) && !isNearRedILine(color);
}
enum _ColorComponent {
diff --git a/packages/palette_generator/palette_generator.iml b/packages/palette_generator/palette_generator.iml
deleted file mode 100644
index c9ef74c..0000000
--- a/packages/palette_generator/palette_generator.iml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="JAVA_MODULE" version="4">
- <component name="NewModuleRootManager" inherit-compiler-output="true">
- <exclude-output />
- <content url="file://$MODULE_DIR$">
- <excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
- <excludeFolder url="file://$MODULE_DIR$/.pub" />
- <excludeFolder url="file://$MODULE_DIR$/build" />
- <excludeFolder url="file://$MODULE_DIR$/example/.dart_tool" />
- <excludeFolder url="file://$MODULE_DIR$/example/.pub" />
- <excludeFolder url="file://$MODULE_DIR$/example/android/app/src/main/java/io/flutter/packages" />
- <excludeFolder url="file://$MODULE_DIR$/example/build" />
- </content>
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="library" name="Dart SDK" level="project" />
- </component>
-</module>
\ No newline at end of file
diff --git a/packages/palette_generator/pubspec.yaml b/packages/palette_generator/pubspec.yaml
index cadb365..16bf682 100644
--- a/packages/palette_generator/pubspec.yaml
+++ b/packages/palette_generator/pubspec.yaml
@@ -2,7 +2,7 @@
description: Flutter package for generating palette colors from a source image.
repository: https://github.com/flutter/packages/tree/main/packages/palette_generator
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+palette_generator%22
-version: 0.3.3+1
+version: 0.3.3+2
environment:
sdk: ">=2.14.0 <3.0.0"
diff --git a/packages/palette_generator/test/palette_generator_test.dart b/packages/palette_generator/test/palette_generator_test.dart
index f5514b8..5e2e810 100644
--- a/packages/palette_generator/test/palette_generator_test.dart
+++ b/packages/palette_generator/test/palette_generator_test.dart
@@ -6,7 +6,7 @@
// TODO(a14n): remove this import once Flutter 3.1 or later reaches stable (including flutter/flutter#104231)
// ignore: unnecessary_import
import 'dart:typed_data';
-import 'dart:ui' as ui show Image, Codec, FrameInfo, instantiateImageCodec;
+import 'dart:ui' as ui show Codec, FrameInfo, Image, instantiateImageCodec;
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
diff --git a/packages/pigeon/CHANGELOG.md b/packages/pigeon/CHANGELOG.md
index c084207..057857e 100644
--- a/packages/pigeon/CHANGELOG.md
+++ b/packages/pigeon/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 4.0.2
+
+* Fixes lint warnings.
+
## 4.0.1
* Exposes `SwiftOptions`.
diff --git a/packages/pigeon/e2e_tests/test_objc/lib/dartle.dart b/packages/pigeon/e2e_tests/test_objc/lib/dartle.dart
index 12104ac..d321f40 100644
--- a/packages/pigeon/e2e_tests/test_objc/lib/dartle.dart
+++ b/packages/pigeon/e2e_tests/test_objc/lib/dartle.dart
@@ -7,9 +7,9 @@
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
// @dart = 2.12
import 'dart:async';
-import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List;
+import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;
-import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer;
+import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
import 'package:flutter/services.dart';
enum MessageRequestState {
diff --git a/packages/pigeon/lib/ast.dart b/packages/pigeon/lib/ast.dart
index faffc7b..ade2287 100644
--- a/packages/pigeon/lib/ast.dart
+++ b/packages/pigeon/lib/ast.dart
@@ -6,7 +6,9 @@
import 'package:meta/meta.dart';
import 'pigeon_lib.dart';
-final Function _listEquals = const ListEquality<dynamic>().equals;
+typedef _ListEquals = bool Function(List<Object?>, List<Object?>);
+
+final _ListEquals _listEquals = const ListEquality<dynamic>().equals;
/// Enum that represents where an [Api] is located, on the host or Flutter.
enum ApiLocation {
diff --git a/packages/pigeon/lib/cpp_generator.dart b/packages/pigeon/lib/cpp_generator.dart
index 8de2c5a..ca2c964 100644
--- a/packages/pigeon/lib/cpp_generator.dart
+++ b/packages/pigeon/lib/cpp_generator.dart
@@ -2,9 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'package:pigeon/functional.dart';
-
import 'ast.dart';
+import 'functional.dart';
import 'generator_tools.dart';
import 'pigeon_lib.dart' show Error;
@@ -576,7 +575,7 @@
});
}
- String _wrapResponse(String reply, TypeDeclaration returnType) {
+ String wrapResponse(String reply, TypeDeclaration returnType) {
String elseBody = '';
final String ifCondition;
final String errorGetter;
@@ -637,7 +636,7 @@
if (method.isAsynchronous) {
methodArgument.add(
'[&wrapped, &reply]($returnTypeName&& output) {${indent.newline}'
- '${_wrapResponse('\treply(wrapped);${indent.newline}', method.returnType)}'
+ '${wrapResponse('\treply(wrapped);${indent.newline}', method.returnType)}'
'}',
);
}
@@ -647,7 +646,7 @@
indent.format('$call;');
} else {
indent.writeln('$returnTypeName output = $call;');
- indent.format(_wrapResponse('', method.returnType));
+ indent.format(wrapResponse('', method.returnType));
}
});
indent.write('catch (const std::exception& exception) ');
@@ -676,7 +675,7 @@
/// Returns an argument name that can be used in a context where it is possible to collide.
String _getSafeArgumentName(int count, NamedType argument) =>
- _getArgumentName(count, argument) + '_arg';
+ '${_getArgumentName(count, argument)}_arg';
void _writeFlutterApiHeader(Indent indent, Api api) {
assert(api.location == ApiLocation.flutter);
@@ -953,10 +952,11 @@
} else {
String typeName = _baseCppTypeForDartType(type);
if (_isReferenceType(typeName)) {
- if (considerReference)
+ if (considerReference) {
typeName = 'const $typeName&';
- else
+ } else {
typeName = 'std::unique_ptr<$typeName>';
+ }
}
return typeName;
}
@@ -970,7 +970,7 @@
if (namespace != null) {
guardName += '${namespace.toUpperCase()}_';
}
- return guardName + 'H_';
+ return '${guardName}H_';
}
void _writeSystemHeaderIncludeBlock(Indent indent, List<String> headers) {
@@ -1147,7 +1147,7 @@
// TODO(gaaclarke): Add line number and filename.
result.add(Error(
message:
- 'Nullable enum types aren\'t supported in C++ arguments in method:${api.name}.${method.name} argument:(${arg.type.baseName} ${arg.name}).'));
+ "Nullable enum types aren't supported in C++ arguments in method:${api.name}.${method.name} argument:(${arg.type.baseName} ${arg.name})."));
}
}
}
diff --git a/packages/pigeon/lib/dart_generator.dart b/packages/pigeon/lib/dart_generator.dart
index a81fe5f..f13c7e7 100644
--- a/packages/pigeon/lib/dart_generator.dart
+++ b/packages/pigeon/lib/dart_generator.dart
@@ -118,7 +118,7 @@
/// Returns an argument name that can be used in a context where it is possible to collide.
String _getSafeArgumentName(int count, NamedType field) =>
- field.name.isEmpty ? 'arg$count' : 'arg_' + field.name;
+ field.name.isEmpty ? 'arg$count' : 'arg_${field.name}';
/// Generates an argument name if one isn't defined.
String _getArgumentName(int count, NamedType field) =>
@@ -199,12 +199,12 @@
'final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(');
indent.nest(2, () {
indent.writeln(
- '\'$channelName\', codec, binaryMessenger: _binaryMessenger);',
+ "'$channelName', codec, binaryMessenger: _binaryMessenger);",
);
});
final String returnType = _makeGenericTypeArguments(func.returnType);
final String castCall = _makeGenericCastCall(func.returnType);
- const String accessor = 'replyMap[\'${Keys.result}\']';
+ const String accessor = "replyMap['${Keys.result}']";
final String nullHandler =
func.returnType.isNullable ? (castCall.isEmpty ? '' : '?') : '!';
final String returnStatement = func.returnType.isVoid
@@ -293,7 +293,7 @@
: channelNameFunc(func);
indent.nest(2, () {
indent.writeln(
- '\'$channelName\', codec, binaryMessenger: binaryMessenger);',
+ "'$channelName', codec, binaryMessenger: binaryMessenger);",
);
});
final String messageHandlerSetter =
@@ -322,7 +322,7 @@
call = 'api.${func.name}()';
} else {
indent.writeln(
- 'assert(message != null, \'Argument for $channelName was null.\');',
+ "assert(message != null, 'Argument for $channelName was null.');",
);
const String argsArray = 'args';
indent.writeln(
@@ -340,7 +340,7 @@
'final $argType? $argName = ($argsArray[$count] as $genericArgType?)${castCall.isEmpty ? '' : '?$castCall'};');
if (!arg.type.isNullable) {
indent.writeln(
- 'assert($argName != null, \'Argument for $channelName was null, expected non-null $argType.\');');
+ "assert($argName != null, 'Argument for $channelName was null, expected non-null $argType.');");
}
});
final Iterable<String> argNames =
@@ -365,7 +365,7 @@
}
const String returnExpression = 'output';
final String returnStatement = isMockHandler
- ? 'return <Object?, Object?>{\'${Keys.result}\': $returnExpression};'
+ ? "return <Object?, Object?>{'${Keys.result}': $returnExpression};"
: 'return $returnExpression;';
indent.writeln(returnStatement);
}
@@ -443,14 +443,14 @@
}
void writeImports() {
- indent.writeln('import \'dart:async\';');
+ indent.writeln("import 'dart:async';");
indent.writeln(
- 'import \'dart:typed_data\' show Uint8List, Int32List, Int64List, Float64List;',
+ "import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;",
);
indent.addln('');
indent.writeln(
- 'import \'package:flutter/foundation.dart\' show WriteBuffer, ReadBuffer;');
- indent.writeln('import \'package:flutter/services.dart\';');
+ "import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;");
+ indent.writeln("import 'package:flutter/services.dart';");
}
void writeDataClass(Class klass) {
@@ -471,7 +471,7 @@
'final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};',
);
for (final NamedType field in klass.fields) {
- indent.write('pigeonMap[\'${field.name}\'] = ');
+ indent.write("pigeonMap['${field.name}'] = ");
final String conditional = field.type.isNullable ? '?' : '';
if (customClassNames.contains(field.type.baseName)) {
indent.addln(
@@ -520,17 +520,17 @@
final String castCall = _makeGenericCastCall(field.type);
final String castCallPrefix = field.type.isNullable ? '?' : '!';
indent.add(
- '(pigeonMap[\'${field.name}\'] as $genericType?)$castCallPrefix$castCall',
+ "(pigeonMap['${field.name}'] as $genericType?)$castCallPrefix$castCall",
);
} else {
final String genericdType = _addGenericTypesNullable(field.type);
if (field.type.isNullable) {
indent.add(
- 'pigeonMap[\'${field.name}\'] as $genericdType',
+ "pigeonMap['${field.name}'] as $genericdType",
);
} else {
indent.add(
- 'pigeonMap[\'${field.name}\']! as $genericdType',
+ "pigeonMap['${field.name}']! as $genericdType",
);
}
}
@@ -630,7 +630,7 @@
try {
final String text = File(pubspecPath).readAsStringSync();
- return (yaml.loadYaml(text) as Map<dynamic, dynamic>)['name'];
+ return (yaml.loadYaml(text) as Map<dynamic, dynamic>)['name'] as String?;
} catch (_) {
return null;
}
@@ -663,14 +663,14 @@
'// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import',
);
indent.writeln('// ignore_for_file: avoid_relative_lib_imports');
- indent.writeln('import \'dart:async\';');
+ indent.writeln("import 'dart:async';");
indent.writeln(
- 'import \'dart:typed_data\' show Uint8List, Int32List, Int64List, Float64List;',
+ "import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;",
);
indent.writeln(
- 'import \'package:flutter/foundation.dart\' show WriteBuffer, ReadBuffer;');
- indent.writeln('import \'package:flutter/services.dart\';');
- indent.writeln('import \'package:flutter_test/flutter_test.dart\';');
+ "import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;");
+ indent.writeln("import 'package:flutter/services.dart';");
+ indent.writeln("import 'package:flutter_test/flutter_test.dart';");
indent.writeln('');
final String relativeDartPath =
path.Context(style: path.Style.posix).relative(
@@ -684,7 +684,7 @@
// certain (older) versions of Dart.
// TODO(gaaclarke): We should add a command-line parameter to override this import.
indent.writeln(
- 'import \'${_escapeForDartSingleQuotedString(relativeDartPath)}\';');
+ "import '${_escapeForDartSingleQuotedString(relativeDartPath)}';");
} else {
final String path = relativeDartPath.replaceFirst(RegExp(r'^.*/lib/'), '');
indent.writeln("import 'package:$packageName/$path';");
diff --git a/packages/pigeon/lib/functional.dart b/packages/pigeon/lib/functional.dart
index 9c50ce6..8e23950 100644
--- a/packages/pigeon/lib/functional.dart
+++ b/packages/pigeon/lib/functional.dart
@@ -32,7 +32,7 @@
yield func(itt.current, itu.current);
}
if (itu.moveNext() || itt.moveNext()) {
- throw ArgumentError('Iterables aren\'t of equal length.');
+ throw ArgumentError("Iterables aren't of equal length.");
}
}
@@ -47,7 +47,7 @@
yield func(itt.current, itu.current, itw.current);
}
if (itu.moveNext() || itt.moveNext() || itw.moveNext()) {
- throw ArgumentError('Iterables aren\'t of equal length.');
+ throw ArgumentError("Iterables aren't of equal length.");
}
}
diff --git a/packages/pigeon/lib/generator_tools.dart b/packages/pigeon/lib/generator_tools.dart
index 6a32c2c..3c89473 100644
--- a/packages/pigeon/lib/generator_tools.dart
+++ b/packages/pigeon/lib/generator_tools.dart
@@ -9,7 +9,7 @@
import 'ast.dart';
/// The current version of pigeon. This must match the version in pubspec.yaml.
-const String pigeonVersion = '4.0.1';
+const String pigeonVersion = '4.0.2';
/// Read all the content from [stdin] to a String.
String readStdin() {
@@ -37,9 +37,7 @@
String get newline {
if (debugGenerators) {
final List<String> frames = StackTrace.current.toString().split('\n');
- return ' //' +
- frames.firstWhere((String x) => x.contains('_generator.dart')) +
- '\n';
+ return ' //${frames.firstWhere((String x) => x.contains('_generator.dart'))}\n';
} else {
return '\n';
}
@@ -119,7 +117,7 @@
/// indentation will be incremented by the given amount.
void nest(int count, Function func) {
inc(count);
- func();
+ func(); // ignore: avoid_dynamic_calls
dec(count);
}
@@ -423,7 +421,7 @@
const int maxCustomClassesPerApi = 255 - _minimumCodecFieldKey;
if (sortedNames.length > maxCustomClassesPerApi) {
throw Exception(
- 'Pigeon doesn\'t support more than $maxCustomClassesPerApi referenced custom classes per API, try splitting up your APIs.');
+ "Pigeon doesn't support more than $maxCustomClassesPerApi referenced custom classes per API, try splitting up your APIs.");
}
for (final String name in sortedNames) {
yield EnumeratedClass(name, enumeration);
diff --git a/packages/pigeon/lib/java_generator.dart b/packages/pigeon/lib/java_generator.dart
index e5a3e08..e414d36 100644
--- a/packages/pigeon/lib/java_generator.dart
+++ b/packages/pigeon/lib/java_generator.dart
@@ -306,7 +306,7 @@
/// Returns an argument name that can be used in a context where it is possible to collide.
String _getSafeArgumentName(int count, NamedType argument) =>
- _getArgumentName(count, argument) + 'Arg';
+ '${_getArgumentName(count, argument)}Arg';
/// Writes the code for a flutter [Api], [api].
/// Example:
@@ -503,7 +503,7 @@
indent.writeln('import java.util.HashMap;');
}
- String _camelToSnake(String camelCase) {
+ String camelToSnake(String camelCase) {
final RegExp regex = RegExp('([a-z])([A-Z]+)');
return camelCase
.replaceAllMapped(regex, (Match m) => '${m[1]}_${m[2]}')
@@ -516,7 +516,7 @@
int index = 0;
for (final String member in anEnum.members) {
indent.writeln(
- '${_camelToSnake(member)}($index)${index == anEnum.members.length - 1 ? ';' : ','}');
+ '${camelToSnake(member)}($index)${index == anEnum.members.length - 1 ? ';' : ','}');
index++;
}
indent.writeln('');
diff --git a/packages/pigeon/lib/objc_generator.dart b/packages/pigeon/lib/objc_generator.dart
index 84dc5cd..088f9e4 100644
--- a/packages/pigeon/lib/objc_generator.dart
+++ b/packages/pigeon/lib/objc_generator.dart
@@ -2,11 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'package:pigeon/functional.dart';
-import 'package:pigeon/pigeon_lib.dart' show TaskQueueType, Error;
-
import 'ast.dart';
+import 'functional.dart';
import 'generator_tools.dart';
+import 'pigeon_lib.dart' show Error, TaskQueueType;
/// Options that control how Objective-C code will be generated.
class ObjcOptions {
@@ -446,14 +445,15 @@
!func.isAsynchronous) {
indent.writeln('/// @return `nil` only when `error != nil`.');
}
- indent.writeln(_makeObjcSignature(
- func: func,
- options: options,
- returnType: returnType,
- lastArgName: lastArgName,
- lastArgType: lastArgType,
- isEnum: (TypeDeclaration t) => isEnum(root, t)) +
- ';');
+ final String signature = _makeObjcSignature(
+ func: func,
+ options: options,
+ returnType: returnType,
+ lastArgName: lastArgName,
+ lastArgType: lastArgType,
+ isEnum: (TypeDeclaration t) => isEnum(root, t),
+ );
+ indent.writeln('$signature;');
}
indent.writeln('@end');
indent.writeln('');
@@ -480,15 +480,14 @@
final _ObjcPtr returnType =
_objcTypeForDartType(options.prefix, func.returnType);
final String callbackType = _callbackForType(func.returnType, returnType);
- indent.writeln(_makeObjcSignature(
- func: func,
- options: options,
- returnType: 'void',
- lastArgName: 'completion',
- lastArgType: callbackType,
- isEnum: (TypeDeclaration t) => isEnum(root, t),
- ) +
- ';');
+ indent.writeln('${_makeObjcSignature(
+ func: func,
+ options: options,
+ returnType: 'void',
+ lastArgName: 'completion',
+ lastArgType: callbackType,
+ isEnum: (TypeDeclaration t) => isEnum(root, t),
+ )};');
}
indent.writeln('@end');
}
@@ -593,7 +592,7 @@
}
String _getSelector(Method func, String lastSelectorComponent) =>
- _getSelectorComponents(func, lastSelectorComponent).join(':') + ':';
+ '${_getSelectorComponents(func, lastSelectorComponent).join(':')}:';
/// Returns an argument name that can be used in a context where it is possible to collide.
String _getSafeArgName(int count, NamedType arg) =>
@@ -990,7 +989,7 @@
// TODO(gaaclarke): Add line number.
errors.add(Error(
message:
- 'Nullable enum types aren\'t support in ObjC arguments in method:${api.name}.${method.name} argument:(${arg.type.baseName} ${arg.name}).'));
+ "Nullable enum types aren't support in ObjC arguments in method:${api.name}.${method.name} argument:(${arg.type.baseName} ${arg.name})."));
}
}
}
diff --git a/packages/pigeon/lib/pigeon.dart b/packages/pigeon/lib/pigeon.dart
index 737954b..d4875c3 100644
--- a/packages/pigeon/lib/pigeon.dart
+++ b/packages/pigeon/lib/pigeon.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-export 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List;
+export 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;
export 'cpp_generator.dart' show CppOptions;
export 'dart_generator.dart' show DartOptions;
diff --git a/packages/pigeon/lib/pigeon_cl.dart b/packages/pigeon/lib/pigeon_cl.dart
index 633ec32..69c3d81 100644
--- a/packages/pigeon/lib/pigeon_cl.dart
+++ b/packages/pigeon/lib/pigeon_cl.dart
@@ -3,7 +3,7 @@
// found in the LICENSE file.
import 'dart:async';
-import 'package:pigeon/pigeon_lib.dart';
+import 'pigeon_lib.dart';
/// This is the main entrypoint for the command-line tool. [args] are the
/// commmand line arguments and there is an optional [packageConfig] to
diff --git a/packages/pigeon/lib/pigeon_lib.dart b/packages/pigeon/lib/pigeon_lib.dart
index 9ac5c68..0e282c6 100644
--- a/packages/pigeon/lib/pigeon_lib.dart
+++ b/packages/pigeon/lib/pigeon_lib.dart
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// ignore_for_file: avoid_print
+
import 'dart:convert';
import 'dart:io';
import 'dart:mirrors';
@@ -19,23 +21,23 @@
import 'package:analyzer/error/error.dart' show AnalysisError;
import 'package:args/args.dart';
import 'package:path/path.dart' as path;
-import 'package:pigeon/cpp_generator.dart';
-import 'package:pigeon/generator_tools.dart';
-import 'package:pigeon/java_generator.dart';
-import 'package:pigeon/swift_generator.dart';
import 'ast.dart';
import 'ast_generator.dart';
+import 'cpp_generator.dart';
import 'dart_generator.dart';
+import 'generator_tools.dart';
import 'generator_tools.dart' as generator_tools;
+import 'java_generator.dart';
import 'objc_generator.dart';
+import 'swift_generator.dart';
class _Asynchronous {
const _Asynchronous();
}
/// Metadata to annotate a Api method as asynchronous
-const _Asynchronous async = _Asynchronous();
+const Object async = _Asynchronous();
/// Metadata annotation used to configure how Pigeon will generate code.
class ConfigurePigeon {
@@ -809,7 +811,7 @@
if (node.uri.stringValue != 'package:pigeon/pigeon.dart') {
_errors.add(Error(
message:
- 'Unsupported import ${node.uri}, only imports of \'package:pigeon/pigeon.dart\' are supported.',
+ "Unsupported import ${node.uri}, only imports of 'package:pigeon/pigeon.dart' are supported.",
lineNumber: _calculateLineNumber(source, node.offset),
));
}
@@ -1011,7 +1013,7 @@
if (node.isStatic) {
_errors.add(Error(
message:
- 'Pigeon doesn\'t support static fields ("${node.toString()}"), consider using enums.',
+ 'Pigeon doesn\'t support static fields ("$node"), consider using enums.',
lineNumber: _calculateLineNumber(source, node.offset)));
} else if (type is dart_ast.NamedType) {
final _FindInitializer findInitializerVisitor = _FindInitializer();
@@ -1033,7 +1035,7 @@
}
} else {
_errors.add(Error(
- message: 'Expected a named type but found "${node.toString()}".',
+ message: 'Expected a named type but found "$node".',
lineNumber: _calculateLineNumber(source, node.offset)));
}
} else if (_currentApi != null) {
@@ -1140,15 +1142,13 @@
/// String that describes how the tool is used.
static String get usage {
return '''
-
Pigeon is a tool for generating type-safe communication code between Flutter
and the host platform.
usage: pigeon --input <pigeon path> --dart_out <dart path> [option]*
options:
-''' +
- _argParser.usage;
+${_argParser.usage}''';
}
static final ArgParser _argParser = ArgParser()
@@ -1182,14 +1182,13 @@
help:
'Path to file with copyright header to be prepended to generated code.')
..addFlag('one_language',
- help: 'Allow Pigeon to only generate code for one language.',
- defaultsTo: false)
+ help: 'Allow Pigeon to only generate code for one language.')
..addOption('ast_out',
help:
'Path to generated AST debugging info. (Warning: format subject to change)')
..addFlag('debug_generators',
- help: 'Print the line number of the generator in comments at newlines.',
- defaultsTo: false);
+ help:
+ 'Print the line number of the generator in comments at newlines.');
/// Convert command-line arguments to [PigeonOptions].
static PigeonOptions parseArgs(List<String> args) {
@@ -1239,7 +1238,7 @@
declaration.parameters[0].type == reflectClass(PigeonOptions)) {
library.invoke(declaration.simpleName, <dynamic>[options]);
} else {
- print('warning: invalid \'configurePigeon\' method defined.');
+ print("warning: invalid 'configurePigeon' method defined.");
}
}
}
diff --git a/packages/pigeon/lib/swift_generator.dart b/packages/pigeon/lib/swift_generator.dart
index 8be4278..43e2eef 100644
--- a/packages/pigeon/lib/swift_generator.dart
+++ b/packages/pigeon/lib/swift_generator.dart
@@ -2,9 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'package:pigeon/functional.dart';
-
import 'ast.dart';
+import 'functional.dart';
import 'generator_tools.dart';
/// Options that control how Swift code will be generated.
@@ -243,7 +242,7 @@
/// Returns an argument name that can be used in a context where it is possible to collide.
String _getSafeArgumentName(int count, NamedType argument) =>
- _getArgumentName(count, argument) + 'Arg';
+ '${_getArgumentName(count, argument)}Arg';
String _camelCase(String text) {
final String pascal = text.split('_').map((String part) {
@@ -407,7 +406,7 @@
root.enums.map((Enum x) => x.name).toSet();
final Indent indent = Indent(sink);
- HostDatatype _getHostDatatype(NamedType field) {
+ HostDatatype getHostDatatype(NamedType field) {
return getFieldHostDatatype(field, root.classes, root.enums,
(TypeDeclaration x) => _swiftTypeForBuiltinDartType(x));
}
@@ -454,7 +453,7 @@
indent.write('return ');
indent.scoped('[', ']', () {
for (final NamedType field in klass.fields) {
- final HostDatatype hostDatatype = _getHostDatatype(field);
+ final HostDatatype hostDatatype = getHostDatatype(field);
String toWriteValue = '';
final String fieldName = field.name;
final String nullsafe = field.type.isNullable ? '?' : '';
@@ -483,7 +482,7 @@
indent.scoped('{', '}', () {
for (final NamedType field in klass.fields) {
- final HostDatatype hostDatatype = _getHostDatatype(field);
+ final HostDatatype hostDatatype = getHostDatatype(field);
final String mapValue = 'map["${field.name}"]';
final String fieldType = _swiftTypeForDartType(field.type);
diff --git a/packages/pigeon/mock_handler_tester/test/message.dart b/packages/pigeon/mock_handler_tester/test/message.dart
index 12104ac..d321f40 100644
--- a/packages/pigeon/mock_handler_tester/test/message.dart
+++ b/packages/pigeon/mock_handler_tester/test/message.dart
@@ -7,9 +7,9 @@
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
// @dart = 2.12
import 'dart:async';
-import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List;
+import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;
-import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer;
+import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
import 'package:flutter/services.dart';
enum MessageRequestState {
diff --git a/packages/pigeon/mock_handler_tester/test/test.dart b/packages/pigeon/mock_handler_tester/test/test.dart
index 3d4dbeb..f0640c2 100644
--- a/packages/pigeon/mock_handler_tester/test/test.dart
+++ b/packages/pigeon/mock_handler_tester/test/test.dart
@@ -8,8 +8,8 @@
// ignore_for_file: avoid_relative_lib_imports
// @dart = 2.12
import 'dart:async';
-import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List;
-import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer;
+import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;
+import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
diff --git a/packages/pigeon/pigeons/all_datatypes.dart b/packages/pigeon/pigeons/all_datatypes.dart
index 8a260d2..ddc693b 100644
--- a/packages/pigeon/pigeons/all_datatypes.dart
+++ b/packages/pigeon/pigeons/all_datatypes.dart
@@ -13,9 +13,9 @@
Int32List? a4ByteArray;
Int64List? a8ByteArray;
Float64List? aFloatArray;
- // ignore: always_specify_types
+ // ignore: always_specify_types, strict_raw_type
List? aList;
- // ignore: always_specify_types
+ // ignore: always_specify_types, strict_raw_type
Map? aMap;
List<List<bool?>?>? nestedList;
Map<String?, String?>? mapWithAnnotations;
diff --git a/packages/pigeon/pigeons/flutter_unittests.dart b/packages/pigeon/pigeons/flutter_unittests.dart
index acde483..8858ad2 100644
--- a/packages/pigeon/pigeons/flutter_unittests.dart
+++ b/packages/pigeon/pigeons/flutter_unittests.dart
@@ -14,12 +14,12 @@
}
class FlutterSearchRequests {
- // ignore: always_specify_types
+ // ignore: always_specify_types, strict_raw_type
List? requests;
}
class FlutterSearchReplies {
- // ignore: always_specify_types
+ // ignore: always_specify_types, strict_raw_type
List? replies;
}
diff --git a/packages/pigeon/pigeons/list.dart b/packages/pigeon/pigeons/list.dart
index 11359e7..c813f74 100644
--- a/packages/pigeon/pigeons/list.dart
+++ b/packages/pigeon/pigeons/list.dart
@@ -5,7 +5,7 @@
import 'package:pigeon/pigeon.dart';
class TestMessage {
- // ignore: always_specify_types
+ // ignore: always_specify_types, strict_raw_type
List? testList;
}
diff --git a/packages/pigeon/pigeons/primitive.dart b/packages/pigeon/pigeons/primitive.dart
index cc8eea5..a333c62 100644
--- a/packages/pigeon/pigeons/primitive.dart
+++ b/packages/pigeon/pigeons/primitive.dart
@@ -10,9 +10,9 @@
bool aBool(bool value);
String aString(String value);
double aDouble(double value);
- // ignore: always_specify_types
+ // ignore: always_specify_types, strict_raw_type
Map aMap(Map value);
- // ignore: always_specify_types
+ // ignore: always_specify_types, strict_raw_type
List aList(List value);
Int32List anInt32List(Int32List value);
List<bool?> aBoolList(List<bool?> value);
@@ -25,9 +25,9 @@
bool aBool(bool value);
String aString(String value);
double aDouble(double value);
- // ignore: always_specify_types
+ // ignore: always_specify_types, strict_raw_type
Map aMap(Map value);
- // ignore: always_specify_types
+ // ignore: always_specify_types, strict_raw_type
List aList(List value);
Int32List anInt32List(Int32List value);
List<bool?> aBoolList(List<bool?> value);
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/all_datatypes.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/all_datatypes.dart
index 61fe409..fa0e4b8 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/all_datatypes.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/all_datatypes.dart
@@ -7,9 +7,9 @@
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
// @dart = 2.12
import 'dart:async';
-import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List;
+import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;
-import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer;
+import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
import 'package:flutter/services.dart';
class Everything {
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart
index 397a65a..e75d34c 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/multiple_arity.gen.dart
@@ -7,9 +7,9 @@
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name
// @dart = 2.12
import 'dart:async';
-import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List;
+import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;
-import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer;
+import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
import 'package:flutter/services.dart';
class _MultipleArityHostApiCodec extends StandardMessageCodec {
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart
index 6062fb8..9cb1e52 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/non_null_fields.gen.dart
@@ -7,9 +7,9 @@
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
// @dart = 2.12
import 'dart:async';
-import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List;
+import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;
-import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer;
+import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
import 'package:flutter/services.dart';
enum ReplyType {
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart
index 495f497..4e6c96b 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_fields.gen.dart
@@ -7,9 +7,9 @@
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
// @dart = 2.12
import 'dart:async';
-import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List;
+import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;
-import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer;
+import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
import 'package:flutter/services.dart';
enum NullFieldsSearchReplyType {
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart
index fabd6ea..25425f8 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/null_safe_pigeon.dart
@@ -7,9 +7,9 @@
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
// @dart = 2.12
import 'dart:async';
-import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List;
+import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;
-import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer;
+import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
import 'package:flutter/services.dart';
class FlutterSearchRequest {
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart
index 7079358..efdff1c 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/nullable_returns.gen.dart
@@ -7,9 +7,9 @@
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name
// @dart = 2.12
import 'dart:async';
-import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List;
+import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;
-import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer;
+import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
import 'package:flutter/services.dart';
class _NullableReturnHostApiCodec extends StandardMessageCodec {
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart
index 7aa576a..806478f 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/lib/primitive.dart
@@ -7,9 +7,9 @@
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name
// @dart = 2.12
import 'dart:async';
-import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List;
+import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;
-import 'package:flutter/foundation.dart' show WriteBuffer, ReadBuffer;
+import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
import 'package:flutter/services.dart';
class _PrimitiveHostApiCodec extends StandardMessageCodec {
diff --git a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_fields_test.dart b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_fields_test.dart
index 11eddac..7cb73be 100644
--- a/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_fields_test.dart
+++ b/packages/pigeon/platform_tests/flutter_null_safe_unit_tests/test/null_fields_test.dart
@@ -27,19 +27,13 @@
test('test request constructor with nulls', () {
final NullFieldsSearchRequest request =
- NullFieldsSearchRequest(query: null, identifier: 1);
+ NullFieldsSearchRequest(identifier: 1);
expect(request.query, isNull);
});
test('test reply constructor with nulls', () {
- final NullFieldsSearchReply reply = NullFieldsSearchReply(
- result: null,
- error: null,
- indices: null,
- request: null,
- type: null,
- );
+ final NullFieldsSearchReply reply = NullFieldsSearchReply();
expect(reply.result, isNull);
expect(reply.error, isNull);
@@ -117,7 +111,7 @@
test('test request encode with null', () {
final NullFieldsSearchRequest request =
- NullFieldsSearchRequest(query: null, identifier: 1);
+ NullFieldsSearchRequest(identifier: 1);
expect(request.encode(), <String, dynamic>{
'query': null,
@@ -147,13 +141,7 @@
});
test('test reply encode with nulls', () {
- final NullFieldsSearchReply reply = NullFieldsSearchReply(
- result: null,
- error: null,
- indices: null,
- request: null,
- type: null,
- );
+ final NullFieldsSearchReply reply = NullFieldsSearchReply();
expect(reply.encode(), <String, dynamic>{
'result': null,
diff --git a/packages/pigeon/pubspec.yaml b/packages/pigeon/pubspec.yaml
index c453ffb..984a5e7 100644
--- a/packages/pigeon/pubspec.yaml
+++ b/packages/pigeon/pubspec.yaml
@@ -2,7 +2,7 @@
description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
repository: https://github.com/flutter/packages/tree/main/packages/pigeon
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3Apigeon
-version: 4.0.1 # This must match the version in lib/generator_tools.dart
+version: 4.0.2 # This must match the version in lib/generator_tools.dart
environment:
sdk: ">=2.12.0 <3.0.0"
diff --git a/packages/pigeon/test/ast_generator_test.dart b/packages/pigeon/test/ast_generator_test.dart
index c9b795d..0718c94 100644
--- a/packages/pigeon/test/ast_generator_test.dart
+++ b/packages/pigeon/test/ast_generator_test.dart
@@ -16,8 +16,7 @@
baseName: 'dataType1',
isNullable: true,
),
- name: 'field1',
- offset: null),
+ name: 'field1'),
],
);
final Root root = Root(
diff --git a/packages/pigeon/test/cpp_generator_test.dart b/packages/pigeon/test/cpp_generator_test.dart
index b8dd3af..14b09e9 100644
--- a/packages/pigeon/test/cpp_generator_test.dart
+++ b/packages/pigeon/test/cpp_generator_test.dart
@@ -19,12 +19,10 @@
baseName: 'Input',
isNullable: false,
),
- name: 'input',
- offset: null)
+ name: 'input')
],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -34,8 +32,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
@@ -43,8 +40,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
])
], enums: <Enum>[]);
{
@@ -79,12 +75,10 @@
baseName: 'Input',
isNullable: false,
),
- name: 'someInput',
- offset: null)
+ name: 'someInput')
],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -94,8 +88,7 @@
baseName: 'bool',
isNullable: false,
),
- name: 'inputField',
- offset: null)
+ name: 'inputField')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
@@ -103,8 +96,7 @@
baseName: 'bool',
isNullable: false,
),
- name: 'outputField',
- offset: null)
+ name: 'outputField')
])
], enums: <Enum>[]);
{
@@ -144,11 +136,9 @@
baseName: 'int',
isNullable: false,
),
- name: 'someInput',
- offset: null)
+ name: 'someInput')
],
returnType: const TypeDeclaration(baseName: 'int', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[], enums: <Enum>[]);
@@ -186,11 +176,9 @@
baseName: 'int',
isNullable: false,
),
- name: 'someInput',
- offset: null)
+ name: 'someInput')
],
returnType: const TypeDeclaration(baseName: 'int', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[], enums: <Enum>[]);
@@ -224,12 +212,10 @@
baseName: 'Input',
isNullable: false,
),
- name: 'input',
- offset: null)
+ name: 'input')
],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -239,8 +225,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
@@ -248,8 +233,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
])
], enums: <Enum>[]);
{
@@ -279,11 +263,9 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
],
returnType: const TypeDeclaration(baseName: 'int', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[], enums: <Enum>[]);
@@ -332,11 +314,9 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
],
returnType: const TypeDeclaration(baseName: 'int', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[], enums: <Enum>[]);
@@ -367,11 +347,9 @@
baseName: 'Input',
isNullable: false,
),
- name: 'someInput',
- offset: null)
+ name: 'someInput')
],
returnType: const TypeDeclaration.voidDeclaration(),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -381,8 +359,7 @@
baseName: 'bool',
isNullable: true,
),
- name: 'nestedValue',
- offset: null),
+ name: 'nestedValue'),
]),
Class(name: 'Input', fields: <NamedType>[
NamedType(
@@ -390,29 +367,25 @@
baseName: 'bool',
isNullable: true,
),
- name: 'nullableBool',
- offset: null),
+ name: 'nullableBool'),
NamedType(
type: const TypeDeclaration(
baseName: 'int',
isNullable: true,
),
- name: 'nullableInt',
- offset: null),
+ name: 'nullableInt'),
NamedType(
type: const TypeDeclaration(
baseName: 'String',
isNullable: true,
),
- name: 'nullableString',
- offset: null),
+ name: 'nullableString'),
NamedType(
type: const TypeDeclaration(
baseName: 'Nested',
isNullable: true,
),
- name: 'nullableNested',
- offset: null),
+ name: 'nullableNested'),
]),
], enums: <Enum>[]);
{
@@ -506,11 +479,9 @@
baseName: 'Input',
isNullable: false,
),
- name: 'someInput',
- offset: null)
+ name: 'someInput')
],
returnType: const TypeDeclaration.voidDeclaration(),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -520,8 +491,7 @@
baseName: 'bool',
isNullable: false,
),
- name: 'nestedValue',
- offset: null),
+ name: 'nestedValue'),
]),
Class(name: 'Input', fields: <NamedType>[
NamedType(
@@ -529,29 +499,25 @@
baseName: 'bool',
isNullable: false,
),
- name: 'nonNullableBool',
- offset: null),
+ name: 'nonNullableBool'),
NamedType(
type: const TypeDeclaration(
baseName: 'int',
isNullable: false,
),
- name: 'nonNullableInt',
- offset: null),
+ name: 'nonNullableInt'),
NamedType(
type: const TypeDeclaration(
baseName: 'String',
isNullable: false,
),
- name: 'nonNullableString',
- offset: null),
+ name: 'nonNullableString'),
NamedType(
type: const TypeDeclaration(
baseName: 'Nested',
isNullable: false,
),
- name: 'nonNullableNested',
- offset: null),
+ name: 'nonNullableNested'),
]),
], enums: <Enum>[]);
{
@@ -615,7 +581,6 @@
baseName: 'bool',
isNullable: true,
),
- isAsynchronous: false,
),
Method(
name: 'returnNullableInt',
@@ -624,7 +589,6 @@
baseName: 'int',
isNullable: true,
),
- isAsynchronous: false,
),
Method(
name: 'returnNullableString',
@@ -633,7 +597,6 @@
baseName: 'String',
isNullable: true,
),
- isAsynchronous: false,
),
Method(
name: 'returnNullableList',
@@ -648,7 +611,6 @@
],
isNullable: true,
),
- isAsynchronous: false,
),
Method(
name: 'returnNullableMap',
@@ -667,7 +629,6 @@
],
isNullable: true,
),
- isAsynchronous: false,
),
Method(
name: 'returnNullableDataClass',
@@ -676,7 +637,6 @@
baseName: 'ReturnData',
isNullable: true,
),
- isAsynchronous: false,
),
])
], classes: <Class>[
@@ -686,8 +646,7 @@
baseName: 'bool',
isNullable: false,
),
- name: 'aValue',
- offset: null),
+ name: 'aValue'),
]),
], enums: <Enum>[]);
{
@@ -727,7 +686,6 @@
baseName: 'bool',
isNullable: false,
),
- isAsynchronous: false,
),
Method(
name: 'returnInt',
@@ -736,7 +694,6 @@
baseName: 'int',
isNullable: false,
),
- isAsynchronous: false,
),
Method(
name: 'returnString',
@@ -745,7 +702,6 @@
baseName: 'String',
isNullable: false,
),
- isAsynchronous: false,
),
Method(
name: 'returnList',
@@ -760,7 +716,6 @@
],
isNullable: false,
),
- isAsynchronous: false,
),
Method(
name: 'returnMap',
@@ -779,7 +734,6 @@
],
isNullable: false,
),
- isAsynchronous: false,
),
Method(
name: 'returnDataClass',
@@ -788,7 +742,6 @@
baseName: 'ReturnData',
isNullable: false,
),
- isAsynchronous: false,
),
])
], classes: <Class>[
@@ -798,8 +751,7 @@
baseName: 'bool',
isNullable: false,
),
- name: 'aValue',
- offset: null),
+ name: 'aValue'),
]),
], enums: <Enum>[]);
{
@@ -866,7 +818,6 @@
)),
],
returnType: const TypeDeclaration.voidDeclaration(),
- isAsynchronous: false,
),
])
], classes: <Class>[
@@ -876,8 +827,7 @@
baseName: 'bool',
isNullable: false,
),
- name: 'aValue',
- offset: null),
+ name: 'aValue'),
]),
], enums: <Enum>[]);
{
@@ -986,7 +936,6 @@
)),
],
returnType: const TypeDeclaration.voidDeclaration(),
- isAsynchronous: false,
),
])
], classes: <Class>[
@@ -996,8 +945,7 @@
baseName: 'bool',
isNullable: false,
),
- name: 'aValue',
- offset: null),
+ name: 'aValue'),
]),
], enums: <Enum>[]);
{
@@ -1064,7 +1012,6 @@
)),
],
returnType: const TypeDeclaration.voidDeclaration(),
- isAsynchronous: false,
),
])
], classes: <Class>[], enums: <Enum>[]);
diff --git a/packages/pigeon/test/dart_generator_test.dart b/packages/pigeon/test/dart_generator_test.dart
index 4d37cdf..ba30219 100644
--- a/packages/pigeon/test/dart_generator_test.dart
+++ b/packages/pigeon/test/dart_generator_test.dart
@@ -20,8 +20,7 @@
baseName: 'dataType1',
isNullable: true,
),
- name: 'field1',
- offset: null),
+ name: 'field1'),
],
);
final Root root = Root(
@@ -68,12 +67,10 @@
baseName: 'Input',
isNullable: false,
),
- name: 'input',
- offset: null)
+ name: 'input')
],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -83,8 +80,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
@@ -92,8 +88,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
])
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -119,7 +114,6 @@
const TypeDeclaration(isNullable: false, baseName: 'int')),
],
returnType: const TypeDeclaration(baseName: 'int', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[], enums: <Enum>[]);
@@ -147,7 +141,6 @@
const TypeDeclaration(isNullable: false, baseName: 'int')),
],
returnType: const TypeDeclaration(baseName: 'int', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[], enums: <Enum>[]);
@@ -173,8 +166,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
],
),
Class(
@@ -185,8 +177,7 @@
baseName: 'Input',
isNullable: true,
),
- name: 'nested',
- offset: null)
+ name: 'nested')
],
)
], enums: <Enum>[]);
@@ -196,13 +187,13 @@
expect(
code,
contains(
- 'pigeonMap[\'nested\'] = nested?.encode()',
+ "pigeonMap['nested'] = nested?.encode()",
),
);
expect(
code.replaceAll('\n', ' ').replaceAll(' ', ''),
contains(
- 'nested: pigeonMap[\'nested\'] != null ? Input.decode(pigeonMap[\'nested\']!) : null',
+ "nested: pigeonMap['nested'] != null ? Input.decode(pigeonMap['nested']!) : null",
),
);
});
@@ -217,8 +208,7 @@
baseName: 'String',
isNullable: false,
),
- name: 'input',
- offset: null)
+ name: 'input')
],
),
Class(
@@ -229,8 +219,7 @@
baseName: 'Input',
isNullable: false,
),
- name: 'nested',
- offset: null)
+ name: 'nested')
],
)
], enums: <Enum>[]);
@@ -240,13 +229,13 @@
expect(
code,
contains(
- 'pigeonMap[\'nested\'] = nested.encode()',
+ "pigeonMap['nested'] = nested.encode()",
),
);
expect(
code.replaceAll('\n', ' ').replaceAll(' ', ''),
contains(
- 'nested: Input.decode(pigeonMap[\'nested\']!)',
+ "nested: Input.decode(pigeonMap['nested']!)",
),
);
});
@@ -262,12 +251,10 @@
baseName: 'Input',
isNullable: false,
),
- name: 'input',
- offset: null)
+ name: 'input')
],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -277,8 +264,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
@@ -286,8 +272,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
])
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -309,11 +294,9 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType: const TypeDeclaration.voidDeclaration(),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -323,8 +306,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -345,11 +327,9 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType: const TypeDeclaration.voidDeclaration(),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -359,8 +339,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -381,7 +360,6 @@
arguments: <NamedType>[],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -391,8 +369,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -413,12 +390,10 @@
baseName: 'EnumClass',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType:
const TypeDeclaration(baseName: 'EnumClass', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -428,8 +403,7 @@
baseName: 'Enum',
isNullable: true,
),
- name: 'enum1',
- offset: null)
+ name: 'enum1')
]),
], enums: <Enum>[
Enum(
@@ -443,8 +417,8 @@
final StringBuffer sink = StringBuffer();
generateDart(const DartOptions(), root, sink);
final String code = sink.toString();
- expect(code, contains('pigeonMap[\'enum1\'] = enum1?.index;'));
- expect(code, contains('? Enum.values[pigeonMap[\'enum1\']! as int]'));
+ expect(code, contains("pigeonMap['enum1'] = enum1?.index;"));
+ expect(code, contains("? Enum.values[pigeonMap['enum1']! as int]"));
expect(code, contains('EnumClass doSomething(EnumClass arg0);'));
});
@@ -483,12 +457,10 @@
baseName: 'EnumClass',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType:
const TypeDeclaration(baseName: 'EnumClass', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -498,8 +470,7 @@
baseName: 'Enum',
isNullable: false,
),
- name: 'enum1',
- offset: null)
+ name: 'enum1')
]),
], enums: <Enum>[
Enum(
@@ -513,8 +484,8 @@
final StringBuffer sink = StringBuffer();
generateDart(const DartOptions(), root, sink);
final String code = sink.toString();
- expect(code, contains('pigeonMap[\'enum1\'] = enum1.index;'));
- expect(code, contains('enum1: Enum.values[pigeonMap[\'enum1\']! as int]'));
+ expect(code, contains("pigeonMap['enum1'] = enum1.index;"));
+ expect(code, contains("enum1: Enum.values[pigeonMap['enum1']! as int]"));
});
test('host void argument', () {
@@ -525,7 +496,6 @@
arguments: <NamedType>[],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -535,8 +505,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -560,12 +529,10 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
- isAsynchronous: false,
),
Method(
name: 'voidReturner',
@@ -575,11 +542,9 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType: const TypeDeclaration.voidDeclaration(),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -589,8 +554,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
@@ -598,19 +562,18 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
])
], enums: <Enum>[]);
final StringBuffer mainCodeSink = StringBuffer();
final StringBuffer testCodeSink = StringBuffer();
generateDart(const DartOptions(), root, mainCodeSink);
final String mainCode = mainCodeSink.toString();
- expect(mainCode, isNot(contains('import \'fo\\\'o.dart\';')));
+ expect(mainCode, isNot(contains(r"import 'fo\'o.dart';")));
expect(mainCode, contains('class Api {'));
expect(mainCode, isNot(contains('abstract class ApiMock')));
expect(mainCode, isNot(contains('.ApiMock.doSomething')));
- expect(mainCode, isNot(contains('\'${Keys.result}\': output')));
+ expect(mainCode, isNot(contains("'${Keys.result}': output")));
expect(mainCode, isNot(contains('return <Object, Object>{};')));
generateTestDart(
const DartOptions(),
@@ -620,11 +583,11 @@
testOutPath: 'test.dart',
);
final String testCode = testCodeSink.toString();
- expect(testCode, contains('import \'fo\\\'o.dart\';'));
+ expect(testCode, contains(r"import 'fo\'o.dart';"));
expect(testCode, isNot(contains('class Api {')));
expect(testCode, contains('abstract class ApiMock'));
expect(testCode, isNot(contains('.ApiMock.doSomething')));
- expect(testCode, contains('\'${Keys.result}\': output'));
+ expect(testCode, contains("'${Keys.result}': output"));
expect(testCode, contains('return <Object?, Object?>{};'));
});
@@ -639,8 +602,7 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
@@ -654,8 +616,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
@@ -663,8 +624,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
])
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -687,8 +647,7 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType: const TypeDeclaration.voidDeclaration(),
isAsynchronous: true,
@@ -701,8 +660,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
@@ -710,8 +668,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
])
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -733,8 +690,7 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
@@ -748,8 +704,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
@@ -757,8 +712,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
])
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -786,8 +740,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -796,7 +749,7 @@
expect(code, matches('channel.send[(]null[)]'));
});
- Iterable<String> _makeIterable(String string) sync* {
+ Iterable<String> makeIterable(String string) sync* {
yield string;
}
@@ -804,7 +757,7 @@
final Root root = Root(apis: <Api>[], classes: <Class>[], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
generateDart(
- DartOptions(copyrightHeader: _makeIterable('hello world')),
+ DartOptions(copyrightHeader: makeIterable('hello world')),
root,
sink,
);
@@ -823,8 +776,7 @@
typeArguments: <TypeDeclaration>[
TypeDeclaration(baseName: 'int', isNullable: true)
]),
- name: 'field1',
- offset: null),
+ name: 'field1'),
],
);
final Root root = Root(
@@ -851,8 +803,7 @@
TypeDeclaration(baseName: 'String', isNullable: true),
TypeDeclaration(baseName: 'int', isNullable: true),
]),
- name: 'field1',
- offset: null),
+ name: 'field1'),
],
);
final Root root = Root(
@@ -882,8 +833,7 @@
typeArguments: <TypeDeclaration>[
TypeDeclaration(baseName: 'int', isNullable: true)
]),
- name: 'arg',
- offset: null)
+ name: 'arg')
])
])
],
@@ -911,8 +861,7 @@
typeArguments: <TypeDeclaration>[
TypeDeclaration(baseName: 'int', isNullable: true)
]),
- name: 'arg',
- offset: null)
+ name: 'arg')
])
])
],
@@ -950,7 +899,7 @@
expect(
code,
contains(
- 'return (replyMap[\'result\'] as List<Object?>?)!.cast<int?>();'));
+ "return (replyMap['result'] as List<Object?>?)!.cast<int?>();"));
});
test('flutter generics argument non void return', () {
@@ -973,8 +922,7 @@
typeArguments: <TypeDeclaration>[
TypeDeclaration(baseName: 'int', isNullable: true)
]),
- name: 'foo',
- offset: null)
+ name: 'foo')
])
])
],
@@ -1012,7 +960,7 @@
generateDart(const DartOptions(), root, sink);
final String code = sink.toString();
expect(code, contains('Future<int?> doit()'));
- expect(code, contains('return (replyMap[\'result\'] as int?);'));
+ expect(code, contains("return (replyMap['result'] as int?);"));
});
test('return nullable collection host', () {
@@ -1040,7 +988,7 @@
expect(
code,
contains(
- 'return (replyMap[\'result\'] as List<Object?>?)?.cast<int?>();'));
+ "return (replyMap['result'] as List<Object?>?)?.cast<int?>();"));
});
test('return nullable async host', () {
@@ -1064,7 +1012,7 @@
generateDart(const DartOptions(), root, sink);
final String code = sink.toString();
expect(code, contains('Future<int?> doit()'));
- expect(code, contains('return (replyMap[\'result\'] as int?);'));
+ expect(code, contains("return (replyMap['result'] as int?);"));
});
test('return nullable flutter', () {
diff --git a/packages/pigeon/test/generator_tools_test.dart b/packages/pigeon/test/generator_tools_test.dart
index a2fa402..8c39144 100644
--- a/packages/pigeon/test/generator_tools_test.dart
+++ b/packages/pigeon/test/generator_tools_test.dart
@@ -80,7 +80,6 @@
],
),
name: '',
- offset: null,
)
],
returnType:
@@ -113,7 +112,6 @@
NamedType(
type: const TypeDeclaration(baseName: 'Output', isNullable: false),
name: '',
- offset: null,
)
],
returnType: const TypeDeclaration(
@@ -151,12 +149,10 @@
NamedType(
type: const TypeDeclaration(baseName: 'Foo', isNullable: false),
name: '',
- offset: null,
),
NamedType(
type: const TypeDeclaration(baseName: 'Bar', isNullable: false),
name: '',
- offset: null,
),
],
returnType: const TypeDeclaration(
@@ -199,7 +195,6 @@
])),
],
returnType: const TypeDeclaration.voidDeclaration(),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -248,7 +243,6 @@
])),
],
returnType: const TypeDeclaration.voidDeclaration(),
- isAsynchronous: false,
)
],
),
@@ -284,7 +278,6 @@
isNullable: false, baseName: 'Foo')),
],
returnType: const TypeDeclaration.voidDeclaration(),
- isAsynchronous: false,
)
],
),
@@ -301,7 +294,6 @@
isNullable: false, baseName: 'Foo')),
],
returnType: const TypeDeclaration.voidDeclaration(),
- isAsynchronous: false,
)
],
)
diff --git a/packages/pigeon/test/java_generator_test.dart b/packages/pigeon/test/java_generator_test.dart
index 947634b..b2eca32 100644
--- a/packages/pigeon/test/java_generator_test.dart
+++ b/packages/pigeon/test/java_generator_test.dart
@@ -17,8 +17,7 @@
baseName: 'int',
isNullable: true,
),
- name: 'field1',
- offset: null),
+ name: 'field1'),
],
);
final Root root = Root(
@@ -72,8 +71,7 @@
baseName: 'int',
isNullable: true,
),
- name: 'field1',
- offset: null)
+ name: 'field1')
],
);
final Root root = Root(
@@ -101,12 +99,10 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -116,8 +112,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
@@ -125,8 +120,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
])
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -146,57 +140,49 @@
baseName: 'bool',
isNullable: true,
),
- name: 'aBool',
- offset: null),
+ name: 'aBool'),
NamedType(
type: const TypeDeclaration(
baseName: 'int',
isNullable: true,
),
- name: 'aInt',
- offset: null),
+ name: 'aInt'),
NamedType(
type: const TypeDeclaration(
baseName: 'double',
isNullable: true,
),
- name: 'aDouble',
- offset: null),
+ name: 'aDouble'),
NamedType(
type: const TypeDeclaration(
baseName: 'String',
isNullable: true,
),
- name: 'aString',
- offset: null),
+ name: 'aString'),
NamedType(
type: const TypeDeclaration(
baseName: 'Uint8List',
isNullable: true,
),
- name: 'aUint8List',
- offset: null),
+ name: 'aUint8List'),
NamedType(
type: const TypeDeclaration(
baseName: 'Int32List',
isNullable: true,
),
- name: 'aInt32List',
- offset: null),
+ name: 'aInt32List'),
NamedType(
type: const TypeDeclaration(
baseName: 'Int64List',
isNullable: true,
),
- name: 'aInt64List',
- offset: null),
+ name: 'aInt64List'),
NamedType(
type: const TypeDeclaration(
baseName: 'Float64List',
isNullable: true,
),
- name: 'aFloat64List',
- offset: null),
+ name: 'aFloat64List'),
]),
], enums: <Enum>[]);
@@ -225,12 +211,10 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -240,8 +224,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
@@ -249,8 +232,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
])
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -272,11 +254,9 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType: const TypeDeclaration.voidDeclaration(),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -286,8 +266,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -309,11 +288,9 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType: const TypeDeclaration.voidDeclaration(),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -323,8 +300,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -343,7 +319,6 @@
arguments: <NamedType>[],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -353,8 +328,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -373,7 +347,6 @@
arguments: <NamedType>[],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -383,8 +356,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -403,8 +375,7 @@
baseName: 'List',
isNullable: true,
),
- name: 'field1',
- offset: null)
+ name: 'field1')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -423,8 +394,7 @@
baseName: 'Map',
isNullable: true,
),
- name: 'field1',
- offset: null)
+ name: 'field1')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -444,8 +414,7 @@
baseName: 'Nested',
isNullable: true,
),
- name: 'nested',
- offset: null)
+ name: 'nested')
],
);
final Class nestedClass = Class(
@@ -456,8 +425,7 @@
baseName: 'int',
isNullable: true,
),
- name: 'data',
- offset: null)
+ name: 'data')
],
);
final Root root = Root(
@@ -490,8 +458,7 @@
baseName: 'Input',
isNullable: false,
),
- name: 'arg',
- offset: null)
+ name: 'arg')
],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
@@ -505,8 +472,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
@@ -514,8 +480,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
])
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -544,8 +509,7 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
@@ -559,8 +523,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
@@ -568,8 +531,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
])
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -597,8 +559,7 @@
baseName: 'Enum1',
isNullable: true,
),
- name: 'enum1',
- offset: null),
+ name: 'enum1'),
],
);
final Root root = Root(
@@ -655,7 +616,7 @@
'Foo fooArg = args.get(0) == null ? null : Foo.values()[(int)args.get(0)];'));
});
- Iterable<String> _makeIterable(String string) sync* {
+ Iterable<String> makeIterable(String string) sync* {
yield string;
}
@@ -664,7 +625,7 @@
final StringBuffer sink = StringBuffer();
final JavaOptions javaOptions = JavaOptions(
className: 'Messages',
- copyrightHeader: _makeIterable('hello world'),
+ copyrightHeader: makeIterable('hello world'),
);
generateJava(javaOptions, root, sink);
final String code = sink.toString();
@@ -682,8 +643,7 @@
typeArguments: <TypeDeclaration>[
TypeDeclaration(baseName: 'int', isNullable: true)
]),
- name: 'field1',
- offset: null),
+ name: 'field1'),
],
);
final Root root = Root(
@@ -711,8 +671,7 @@
TypeDeclaration(baseName: 'String', isNullable: true),
TypeDeclaration(baseName: 'String', isNullable: true),
]),
- name: 'field1',
- offset: null),
+ name: 'field1'),
],
);
final Root root = Root(
@@ -743,8 +702,7 @@
typeArguments: <TypeDeclaration>[
TypeDeclaration(baseName: 'int', isNullable: true)
]),
- name: 'arg',
- offset: null)
+ name: 'arg')
])
])
],
@@ -773,8 +731,7 @@
typeArguments: <TypeDeclaration>[
TypeDeclaration(baseName: 'int', isNullable: true)
]),
- name: 'arg',
- offset: null)
+ name: 'arg')
])
])
],
@@ -882,7 +839,6 @@
const TypeDeclaration(isNullable: false, baseName: 'int')),
],
returnType: const TypeDeclaration(baseName: 'int', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[], enums: <Enum>[]);
@@ -918,7 +874,6 @@
const TypeDeclaration(isNullable: false, baseName: 'int')),
],
returnType: const TypeDeclaration(baseName: 'int', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[], enums: <Enum>[]);
diff --git a/packages/pigeon/test/objc_generator_test.dart b/packages/pigeon/test/objc_generator_test.dart
index 58e6301..5754601 100644
--- a/packages/pigeon/test/objc_generator_test.dart
+++ b/packages/pigeon/test/objc_generator_test.dart
@@ -13,8 +13,7 @@
Class(name: 'Foobar', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'field1',
- offset: null)
+ name: 'field1')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -29,8 +28,7 @@
Class(name: 'Foobar', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'field1',
- offset: null)
+ name: 'field1')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -86,13 +84,11 @@
NamedType(
type:
const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'field1',
- offset: null),
+ name: 'field1'),
NamedType(
type:
const TypeDeclaration(baseName: 'Enum1', isNullable: true),
- name: 'enum1',
- offset: null),
+ name: 'enum1'),
],
),
],
@@ -183,13 +179,11 @@
NamedType(
type:
const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'field1',
- offset: null),
+ name: 'field1'),
NamedType(
type:
const TypeDeclaration(baseName: 'Enum1', isNullable: true),
- name: 'enum1',
- offset: null),
+ name: 'enum1'),
],
),
],
@@ -218,8 +212,7 @@
NamedType(
type: const TypeDeclaration(
baseName: 'Input', isNullable: false),
- name: '',
- offset: null)
+ name: '')
],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false))
@@ -228,14 +221,12 @@
Class(name: 'Input', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'output',
- offset: null)
+ name: 'output')
])
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -260,8 +251,7 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false))
@@ -270,14 +260,12 @@
Class(name: 'Input', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'output',
- offset: null)
+ name: 'output')
])
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -298,40 +286,32 @@
Class(name: 'Foobar', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'bool', isNullable: true),
- name: 'aBool',
- offset: null),
+ name: 'aBool'),
NamedType(
type: const TypeDeclaration(baseName: 'int', isNullable: true),
- name: 'aInt',
- offset: null),
+ name: 'aInt'),
NamedType(
type: const TypeDeclaration(baseName: 'double', isNullable: true),
- name: 'aDouble',
- offset: null),
+ name: 'aDouble'),
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'aString',
- offset: null),
+ name: 'aString'),
NamedType(
type:
const TypeDeclaration(baseName: 'Uint8List', isNullable: true),
- name: 'aUint8List',
- offset: null),
+ name: 'aUint8List'),
NamedType(
type:
const TypeDeclaration(baseName: 'Int32List', isNullable: true),
- name: 'aInt32List',
- offset: null),
+ name: 'aInt32List'),
NamedType(
type:
const TypeDeclaration(baseName: 'Int64List', isNullable: true),
- name: 'aInt64List',
- offset: null),
+ name: 'aInt64List'),
NamedType(
type: const TypeDeclaration(
baseName: 'Float64List', isNullable: true),
- name: 'aFloat64List',
- offset: null),
+ name: 'aFloat64List'),
]),
], enums: <Enum>[]);
@@ -359,8 +339,7 @@
Class(name: 'Foobar', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'bool', isNullable: true),
- name: 'aBool',
- offset: null),
+ name: 'aBool'),
]),
], enums: <Enum>[]);
@@ -377,14 +356,12 @@
Class(name: 'Input', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Nested', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'Input', isNullable: true),
- name: 'nested',
- offset: null)
+ name: 'nested')
])
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -399,14 +376,12 @@
Class(name: 'Input', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Nested', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'Input', isNullable: true),
- name: 'nested',
- offset: null)
+ name: 'nested')
])
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -424,8 +399,7 @@
Class(name: 'Foobar', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'field1',
- offset: null)
+ name: 'field1')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -439,8 +413,7 @@
Class(name: 'Foobar', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'field1',
- offset: null)
+ name: 'field1')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -460,8 +433,7 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType:
const TypeDeclaration(baseName: 'Nested', isNullable: false))
@@ -470,14 +442,12 @@
Class(name: 'Input', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Nested', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'Input', isNullable: true),
- name: 'nested',
- offset: null)
+ name: 'nested')
])
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -499,8 +469,7 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType:
const TypeDeclaration(baseName: 'Nested', isNullable: false))
@@ -509,14 +478,12 @@
Class(name: 'Input', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Nested', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'Input', isNullable: true),
- name: 'nested',
- offset: null)
+ name: 'nested')
])
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -538,8 +505,7 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false))
@@ -548,14 +514,12 @@
Class(name: 'Input', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'output',
- offset: null)
+ name: 'output')
])
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -580,8 +544,7 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false))
@@ -590,14 +553,12 @@
Class(name: 'Input', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'output',
- offset: null)
+ name: 'output')
])
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -618,8 +579,7 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType: const TypeDeclaration.voidDeclaration())
])
@@ -627,8 +587,7 @@
Class(name: 'Input', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'input',
- offset: null)
+ name: 'input')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -649,8 +608,7 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType: const TypeDeclaration.voidDeclaration())
])
@@ -658,8 +616,7 @@
Class(name: 'Input', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'input',
- offset: null)
+ name: 'input')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -682,8 +639,7 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType: const TypeDeclaration.voidDeclaration())
])
@@ -691,8 +647,7 @@
Class(name: 'Input', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'input',
- offset: null)
+ name: 'input')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -713,8 +668,7 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType: const TypeDeclaration.voidDeclaration())
])
@@ -722,8 +676,7 @@
Class(name: 'Input', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'input',
- offset: null)
+ name: 'input')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -747,8 +700,7 @@
Class(name: 'Output', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'output',
- offset: null)
+ name: 'output')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -771,8 +723,7 @@
Class(name: 'Output', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'output',
- offset: null)
+ name: 'output')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -795,8 +746,7 @@
Class(name: 'Output', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'output',
- offset: null)
+ name: 'output')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -822,8 +772,7 @@
Class(name: 'Output', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'output',
- offset: null)
+ name: 'output')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -842,8 +791,7 @@
Class(name: 'Foobar', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'List', isNullable: true),
- name: 'field1',
- offset: null)
+ name: 'field1')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -858,8 +806,7 @@
Class(name: 'Foobar', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'Map', isNullable: true),
- name: 'field1',
- offset: null)
+ name: 'field1')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -880,8 +827,7 @@
TypeDeclaration(baseName: 'String', isNullable: true),
TypeDeclaration(baseName: 'Object', isNullable: true),
]),
- name: 'field1',
- offset: null)
+ name: 'field1')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -930,8 +876,7 @@
baseName: 'Input',
isNullable: false,
),
- name: 'input',
- offset: null)
+ name: 'input')
],
returnType: const TypeDeclaration.voidDeclaration(),
isAsynchronous: true)
@@ -940,14 +885,12 @@
Class(name: 'Input', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'output',
- offset: null)
+ name: 'output')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -971,8 +914,7 @@
baseName: 'Input',
isNullable: false,
),
- name: 'input',
- offset: null)
+ name: 'input')
],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
@@ -982,14 +924,12 @@
Class(name: 'Input', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'output',
- offset: null)
+ name: 'output')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -1016,8 +956,7 @@
Class(name: 'Output', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'output',
- offset: null)
+ name: 'output')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -1061,8 +1000,7 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
@@ -1072,14 +1010,12 @@
Class(name: 'Input', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'output',
- offset: null)
+ name: 'output')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -1103,8 +1039,7 @@
baseName: 'Input',
isNullable: false,
),
- name: 'foo',
- offset: null)
+ name: 'foo')
],
returnType: const TypeDeclaration.voidDeclaration(),
isAsynchronous: true)
@@ -1113,14 +1048,12 @@
Class(name: 'Input', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'output',
- offset: null)
+ name: 'output')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -1167,8 +1100,7 @@
Class(name: 'Output', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: true),
- name: 'output',
- offset: null)
+ name: 'output')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -1181,7 +1113,7 @@
'[api doSomethingWithCompletion:^(ABCOutput *_Nullable output, FlutterError *_Nullable error) {'));
});
- Iterable<String> _makeIterable(String string) sync* {
+ Iterable<String> makeIterable(String string) sync* {
yield string;
}
@@ -1192,7 +1124,7 @@
ObjcOptions(
header: 'foo.h',
prefix: 'ABC',
- copyrightHeader: _makeIterable('hello world')),
+ copyrightHeader: makeIterable('hello world')),
root,
sink,
);
@@ -1207,7 +1139,7 @@
ObjcOptions(
header: 'foo.h',
prefix: 'ABC',
- copyrightHeader: _makeIterable('hello world')),
+ copyrightHeader: makeIterable('hello world')),
root,
sink,
);
@@ -1226,8 +1158,7 @@
typeArguments: <TypeDeclaration>[
TypeDeclaration(baseName: 'int', isNullable: true)
]),
- name: 'field1',
- offset: null),
+ name: 'field1'),
],
);
final Root root = Root(
@@ -1257,8 +1188,7 @@
typeArguments: <TypeDeclaration>[
TypeDeclaration(baseName: 'int', isNullable: true)
]),
- name: 'arg',
- offset: null)
+ name: 'arg')
])
])
],
@@ -1299,8 +1229,7 @@
typeArguments: <TypeDeclaration>[
TypeDeclaration(baseName: 'int', isNullable: true)
]),
- name: 'arg',
- offset: null)
+ name: 'arg')
])
])
],
@@ -1344,8 +1273,7 @@
baseName: 'bool', isNullable: true)
]),
]),
- name: 'arg',
- offset: null)
+ name: 'arg')
])
])
],
@@ -1448,7 +1376,6 @@
const TypeDeclaration(isNullable: false, baseName: 'int')),
],
returnType: const TypeDeclaration(baseName: 'int', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[], enums: <Enum>[]);
@@ -1537,7 +1464,6 @@
const TypeDeclaration(isNullable: false, baseName: 'int')),
],
returnType: const TypeDeclaration(baseName: 'int', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[], enums: <Enum>[]);
@@ -1567,7 +1493,7 @@
}
});
- Root _getDivideRoot(ApiLocation location) => Root(
+ Root getDivideRoot(ApiLocation location) => Root(
apis: <Api>[
Api(name: 'Api', location: location, methods: <Method>[
Method(
@@ -1594,7 +1520,7 @@
);
test('host custom objc selector', () {
- final Root divideRoot = _getDivideRoot(ApiLocation.host);
+ final Root divideRoot = getDivideRoot(ApiLocation.host);
{
final StringBuffer sink = StringBuffer();
generateObjcHeader(
@@ -1612,7 +1538,7 @@
});
test('flutter custom objc selector', () {
- final Root divideRoot = _getDivideRoot(ApiLocation.flutter);
+ final Root divideRoot = getDivideRoot(ApiLocation.flutter);
{
final StringBuffer sink = StringBuffer();
generateObjcHeader(
@@ -1640,8 +1566,7 @@
Class(name: 'Foobar', fields: <NamedType>[
NamedType(
type: const TypeDeclaration(baseName: 'String', isNullable: false),
- name: 'field1',
- offset: null)
+ name: 'field1')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
diff --git a/packages/pigeon/test/pigeon_lib_test.dart b/packages/pigeon/test/pigeon_lib_test.dart
index da061d0..6b28183 100644
--- a/packages/pigeon/test/pigeon_lib_test.dart
+++ b/packages/pigeon/test/pigeon_lib_test.dart
@@ -34,7 +34,7 @@
/// Creates a temporary file named [filename] then calls [callback] with a
/// [File] representing that temporary directory. The file will be deleted
/// after the [callback] is executed.
- void _withTempFile(String filename, void Function(File) callback) {
+ void withTempFile(String filename, void Function(File) callback) {
final Directory dir = Directory.systemTemp.createTempSync();
final String path = '${dir.path}/$filename';
final File file = File(path);
@@ -46,10 +46,10 @@
}
}
- ParseResults _parseSource(String source) {
+ ParseResults parseSource(String source) {
final Pigeon dartle = Pigeon.setup();
ParseResults? results;
- _withTempFile('source.dart', (File file) {
+ withTempFile('source.dart', (File file) {
file.writeAsStringSync(source);
results = dartle.parseFile(file.path);
});
@@ -142,7 +142,7 @@
Output1 doit(Input1 input);
}
''';
- final ParseResults parseResult = _parseSource(code);
+ final ParseResults parseResult = parseSource(code);
expect(parseResult.errors.length, equals(0));
final Root root = parseResult.root;
expect(root.classes.length, equals(2));
@@ -189,7 +189,7 @@
InvalidDatatype foo();
}
''';
- final ParseResults results = _parseSource(source);
+ final ParseResults results = parseSource(source);
expect(results.errors.length, 1);
expect(results.errors[0].message, contains('InvalidDatatype'));
expect(results.errors[0].message, contains('dynamic'));
@@ -211,7 +211,7 @@
ClassWithEnum foo();
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, equals(0));
expect(results.root.classes.length, equals(1));
expect(results.root.classes[0].name, equals('ClassWithEnum'));
@@ -237,7 +237,7 @@
Output1 method2(Input1 input);
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 0);
expect(results.root.apis.length, 1);
expect(results.root.apis[0].methods.length, equals(2));
@@ -260,7 +260,7 @@
Nested foo();
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, equals(0));
expect(results.root.classes.length, equals(2));
final Class nested =
@@ -285,7 +285,7 @@
Output1 doit(Input1 input);
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, equals(0));
expect(results.root.apis.length, equals(1));
expect(results.root.apis[0].name, equals('AFlutterApi'));
@@ -303,7 +303,7 @@
void doit(Input1 input);
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, equals(0));
expect(results.root.apis.length, equals(1));
expect(results.root.apis[0].methods.length, equals(1));
@@ -322,7 +322,7 @@
Output1 doit();
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, equals(0));
expect(results.root.apis.length, equals(1));
expect(results.root.apis[0].methods.length, equals(1));
@@ -343,7 +343,7 @@
Output1 doit();
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, equals(0));
expect(results.root.apis.length, equals(1));
expect(results.root.apis[0].dartHostTestHandler,
@@ -365,7 +365,7 @@
Nestor getit();
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 0);
expect(results.root.apis.length, 1);
final List<String> classNames =
@@ -473,7 +473,7 @@
void method(NestedEnum3 foo);
}
''';
- final ParseResults parseResult = _parseSource(code);
+ final ParseResults parseResult = parseSource(code);
expect(parseResult.errors.length, equals(0));
expect(parseResult.root.apis.length, 1);
expect(parseResult.root.classes.length, 3);
@@ -495,7 +495,7 @@
void doit(Foo foo);
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 0);
expect(results.root.classes.length, 2);
final Class foo =
@@ -506,7 +506,7 @@
test('test compilation error', () {
const String code = 'Hello\n';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, greaterThanOrEqualTo(1));
expect(results.errors[0].lineNumber, 1);
});
@@ -523,7 +523,7 @@
Foo doit(Foo foo);
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 1);
expect(results.errors[0].lineNumber, 3);
expect(results.errors[0].message, contains('Method'));
@@ -540,7 +540,7 @@
Foo doit(Foo foo);
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 1);
expect(results.errors[0].lineNumber, 2);
expect(results.errors[0].message, contains('Initialization'));
@@ -558,7 +558,7 @@
Foo doit(Foo foo);
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 1);
expect(results.errors[0].lineNumber, 7);
expect(results.errors[0].message, contains('Field'));
@@ -576,7 +576,7 @@
Foo doit(Foo foo);
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 0);
});
@@ -592,7 +592,7 @@
Foo doit(Foo foo);
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 1);
expect(results.errors[0].lineNumber, 3);
expect(results.errors[0].message, contains('Constructor'));
@@ -610,7 +610,7 @@
Foo doit(Foo foo);
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 1);
expect(results.errors[0].lineNumber, 3);
expect(results.errors[0].message, contains('Constructor'));
@@ -628,22 +628,22 @@
Foo doit(Foo foo);
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 1);
expect(results.errors[0].lineNumber, 7);
expect(results.errors[0].message, contains('Constructor'));
});
test('test invalid import', () {
- const String code = 'import \'foo.dart\';\n';
- final ParseResults results = _parseSource(code);
+ const String code = "import 'foo.dart';\n";
+ final ParseResults results = parseSource(code);
expect(results.errors.length, greaterThanOrEqualTo(1));
expect(results.errors[0].lineNumber, 1);
});
test('test valid import', () {
- const String code = 'import \'package:pigeon/pigeon.dart\';\n';
- final ParseResults parseResults = _parseSource(code);
+ const String code = "import 'package:pigeon/pigeon.dart';\n";
+ final ParseResults parseResults = parseSource(code);
expect(parseResults.errors.length, 0);
});
@@ -659,7 +659,7 @@
void doit(WithStaticField withTemplate);
}
''';
- final ParseResults parseResult = _parseSource(code);
+ final ParseResults parseResult = parseSource(code);
expect(parseResult.errors.length, equals(1));
expect(parseResult.errors[0].message, contains('static field'));
expect(parseResult.errors[0].lineNumber, isNotNull);
@@ -676,7 +676,7 @@
void doit(Foo foo);
}
''';
- final ParseResults parseResult = _parseSource(code);
+ final ParseResults parseResult = parseSource(code);
expect(parseResult.errors.length, equals(0));
final NamedType field = parseResult.root.classes[0].fields[0];
expect(field.type.typeArguments.length, 1);
@@ -694,7 +694,7 @@
void doit(Foo foo);
}
''';
- final ParseResults parseResult = _parseSource(code);
+ final ParseResults parseResult = parseSource(code);
expect(parseResult.errors.length, equals(0));
final NamedType field = parseResult.root.classes[0].fields[0];
expect(field.type.typeArguments.length, 1);
@@ -713,7 +713,7 @@
void doit(Foo foo);
}
''';
- final ParseResults parseResult = _parseSource(code);
+ final ParseResults parseResult = parseSource(code);
expect(parseResult.errors.length, equals(1));
expect(parseResult.errors[0].message,
contains('Generic type arguments must be nullable'));
@@ -733,7 +733,7 @@
void doit(Foo foo);
}
''';
- final ParseResults parseResult = _parseSource(code);
+ final ParseResults parseResult = parseSource(code);
expect(parseResult.errors.length, equals(0));
});
@@ -751,7 +751,7 @@
void doit(Foo foo);
}
''';
- final ParseResults parseResult = _parseSource(code);
+ final ParseResults parseResult = parseSource(code);
expect(parseResult.errors.length, equals(1));
expect(parseResult.errors[0].message, contains('Enums'));
});
@@ -770,7 +770,7 @@
Foo doit();
}
''';
- final ParseResults parseResult = _parseSource(code);
+ final ParseResults parseResult = parseSource(code);
expect(parseResult.errors.length, equals(1));
expect(parseResult.errors[0].message, contains('Enums'));
});
@@ -782,7 +782,7 @@
List<double?> doit();
}
''';
- final ParseResults parseResult = _parseSource(code);
+ final ParseResults parseResult = parseSource(code);
expect(parseResult.root.apis[0].methods[0].returnType.baseName, 'List');
expect(
parseResult
@@ -801,7 +801,7 @@
void doit(int x, List<double?> value);
}
''';
- final ParseResults parseResult = _parseSource(code);
+ final ParseResults parseResult = parseSource(code);
expect(
parseResult.root.apis[0].methods[0].arguments[1].type.baseName, 'List');
expect(
@@ -825,7 +825,7 @@
void doit(Foo foo);
}
''';
- final ParseResults parseResult = _parseSource(code);
+ final ParseResults parseResult = parseSource(code);
final NamedType field = parseResult.root.classes[0].fields[0];
expect(field.type.typeArguments.length, 2);
expect(field.type.typeArguments[0].baseName, 'String');
@@ -843,7 +843,7 @@
void method(Input input1, Input input2);
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.root.apis.length, 1);
expect(results.root.apis[0].methods.length, equals(1));
expect(results.root.apis[0].methods[0].name, equals('method'));
@@ -857,7 +857,7 @@
void method(x);
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 1);
expect(results.errors[0].lineNumber, 3);
expect(results.errors[0].message,
@@ -872,7 +872,7 @@
void subtract(int x, int y);
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 0);
expect(results.root.apis.length, 1);
expect(results.root.apis[0].methods.length, equals(1));
@@ -888,7 +888,7 @@
void subtract(int x, int y);
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 1);
expect(results.errors[0].lineNumber, 3);
expect(results.errors[0].message,
@@ -903,7 +903,7 @@
void initialize();
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 0);
expect(results.root.apis.length, 1);
expect(results.root.apis[0].methods.length, equals(1));
@@ -934,7 +934,7 @@
List<Foo?> grabAll();
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 0);
expect(results.root.classes.length, 1);
expect(results.root.classes[0].name, 'Foo');
@@ -951,7 +951,7 @@
void storeAll(List<Foo?> foos);
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 0);
expect(results.root.classes.length, 1);
expect(results.root.classes[0].name, 'Foo');
@@ -973,7 +973,7 @@
void storeAll(List<Foo?> foos);
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 0);
expect(results.root.classes.length, 2);
expect(
@@ -995,7 +995,7 @@
void storeAll(List<Foo?> foos);
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 1);
expect(results.errors[0].lineNumber, 3);
expect(results.errors[0].message, contains('Unknown type: Foo'));
@@ -1008,7 +1008,7 @@
void storeAll(List<Object?> foos);
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 0);
});
@@ -1030,7 +1030,7 @@
void sendMessage(Message message);
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 1);
});
@@ -1052,7 +1052,7 @@
void sendMessage(Message message);
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.root.enums.length, 1);
expect(results.root.enums[0].name, 'MessageKey');
});
@@ -1067,7 +1067,7 @@
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
final PigeonOptions options = PigeonOptions.fromMap(results.pigeonOptions!);
expect(options.javaOptions!.copyrightHeader, <String>['A', 'Header']);
});
@@ -1082,7 +1082,7 @@
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
final PigeonOptions options = PigeonOptions.fromMap(results.pigeonOptions!);
expect(options.dartOptions!.copyrightHeader, <String>['A', 'Header']);
});
@@ -1097,7 +1097,7 @@
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
final PigeonOptions options = PigeonOptions.fromMap(results.pigeonOptions!);
expect(options.objcOptions!.copyrightHeader, <String>['A', 'Header']);
});
@@ -1110,7 +1110,7 @@
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 0);
expect(results.root.apis[0].methods[0].returnType.isNullable, isTrue);
});
@@ -1122,7 +1122,7 @@
void calc(int? value);
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 0);
expect(
results.root.apis[0].methods[0].arguments[0].type.isNullable, isTrue);
@@ -1137,7 +1137,7 @@
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 0);
expect(results.root.apis[0].methods[0].taskQueueType,
equals(TaskQueueType.serialBackgroundThread));
@@ -1151,7 +1151,7 @@
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 0);
expect(results.root.apis[0].methods[0].taskQueueType,
equals(TaskQueueType.serial));
@@ -1166,7 +1166,7 @@
}
''';
- final ParseResults results = _parseSource(code);
+ final ParseResults results = parseSource(code);
expect(results.errors.length, 1);
expect(results.errors[0].message,
contains('Unsupported TaskQueue specification'));
@@ -1174,7 +1174,7 @@
test('generator validation', () async {
final Completer<void> completer = Completer<void>();
- _withTempFile('foo.dart', (File input) async {
+ withTempFile('foo.dart', (File input) async {
final _ValidatorGenerator generator = _ValidatorGenerator(stdout);
final int result = await Pigeon.run(<String>['--input', input.path],
generators: <Generator>[generator]);
@@ -1187,7 +1187,7 @@
test('generator validation skipped', () async {
final Completer<void> completer = Completer<void>();
- _withTempFile('foo.dart', (File input) async {
+ withTempFile('foo.dart', (File input) async {
final _ValidatorGenerator generator = _ValidatorGenerator(null);
final int result = await Pigeon.run(
<String>['--input', input.path, '--dart_out', 'foo.dart'],
diff --git a/packages/pigeon/test/swift_generator_test.dart b/packages/pigeon/test/swift_generator_test.dart
index 436d291..319054f 100644
--- a/packages/pigeon/test/swift_generator_test.dart
+++ b/packages/pigeon/test/swift_generator_test.dart
@@ -16,8 +16,7 @@
baseName: 'int',
isNullable: true,
),
- name: 'field1',
- offset: null),
+ name: 'field1'),
],
);
final Root root = Root(
@@ -93,12 +92,10 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -108,8 +105,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
@@ -117,8 +113,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
])
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -138,57 +133,49 @@
baseName: 'bool',
isNullable: true,
),
- name: 'aBool',
- offset: null),
+ name: 'aBool'),
NamedType(
type: const TypeDeclaration(
baseName: 'int',
isNullable: true,
),
- name: 'aInt',
- offset: null),
+ name: 'aInt'),
NamedType(
type: const TypeDeclaration(
baseName: 'double',
isNullable: true,
),
- name: 'aDouble',
- offset: null),
+ name: 'aDouble'),
NamedType(
type: const TypeDeclaration(
baseName: 'String',
isNullable: true,
),
- name: 'aString',
- offset: null),
+ name: 'aString'),
NamedType(
type: const TypeDeclaration(
baseName: 'Uint8List',
isNullable: true,
),
- name: 'aUint8List',
- offset: null),
+ name: 'aUint8List'),
NamedType(
type: const TypeDeclaration(
baseName: 'Int32List',
isNullable: true,
),
- name: 'aInt32List',
- offset: null),
+ name: 'aInt32List'),
NamedType(
type: const TypeDeclaration(
baseName: 'Int64List',
isNullable: true,
),
- name: 'aInt64List',
- offset: null),
+ name: 'aInt64List'),
NamedType(
type: const TypeDeclaration(
baseName: 'Float64List',
isNullable: true,
),
- name: 'aFloat64List',
- offset: null),
+ name: 'aFloat64List'),
]),
], enums: <Enum>[]);
@@ -217,12 +204,10 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -232,8 +217,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
@@ -241,8 +225,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
])
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -265,11 +248,9 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType: const TypeDeclaration.voidDeclaration(),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -279,8 +260,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -302,11 +282,9 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType: const TypeDeclaration.voidDeclaration(),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -316,8 +294,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -336,7 +313,6 @@
arguments: <NamedType>[],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -346,8 +322,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -367,7 +342,6 @@
arguments: <NamedType>[],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -377,8 +351,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -398,8 +371,7 @@
baseName: 'List',
isNullable: true,
),
- name: 'field1',
- offset: null)
+ name: 'field1')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -418,8 +390,7 @@
baseName: 'Map',
isNullable: true,
),
- name: 'field1',
- offset: null)
+ name: 'field1')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -439,8 +410,7 @@
baseName: 'Nested',
isNullable: true,
),
- name: 'nested',
- offset: null)
+ name: 'nested')
],
);
final Class nestedClass = Class(
@@ -451,8 +421,7 @@
baseName: 'int',
isNullable: true,
),
- name: 'data',
- offset: null)
+ name: 'data')
],
);
final Root root = Root(
@@ -484,8 +453,7 @@
baseName: 'Input',
isNullable: false,
),
- name: 'arg',
- offset: null)
+ name: 'arg')
],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
@@ -499,8 +467,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
@@ -508,8 +475,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
])
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -532,8 +498,7 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType:
const TypeDeclaration(baseName: 'Output', isNullable: false),
@@ -547,8 +512,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
Class(name: 'Output', fields: <NamedType>[
NamedType(
@@ -556,8 +520,7 @@
baseName: 'String',
isNullable: true,
),
- name: 'output',
- offset: null)
+ name: 'output')
])
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
@@ -584,8 +547,7 @@
baseName: 'Enum1',
isNullable: true,
),
- name: 'enum1',
- offset: null),
+ name: 'enum1'),
],
);
final Root root = Root(
@@ -602,7 +564,7 @@
expect(code, contains('case two = 1'));
});
- Iterable<String> _makeIterable(String string) sync* {
+ Iterable<String> makeIterable(String string) sync* {
yield string;
}
@@ -610,7 +572,7 @@
final Root root = Root(apis: <Api>[], classes: <Class>[], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
final SwiftOptions swiftOptions = SwiftOptions(
- copyrightHeader: _makeIterable('hello world'),
+ copyrightHeader: makeIterable('hello world'),
);
generateSwift(swiftOptions, root, sink);
final String code = sink.toString();
@@ -628,8 +590,7 @@
typeArguments: <TypeDeclaration>[
TypeDeclaration(baseName: 'int', isNullable: true)
]),
- name: 'field1',
- offset: null),
+ name: 'field1'),
],
);
final Root root = Root(
@@ -657,8 +618,7 @@
TypeDeclaration(baseName: 'String', isNullable: true),
TypeDeclaration(baseName: 'String', isNullable: true),
]),
- name: 'field1',
- offset: null),
+ name: 'field1'),
],
);
final Root root = Root(
@@ -689,8 +649,7 @@
typeArguments: <TypeDeclaration>[
TypeDeclaration(baseName: 'int', isNullable: true)
]),
- name: 'arg',
- offset: null)
+ name: 'arg')
])
])
],
@@ -719,8 +678,7 @@
typeArguments: <TypeDeclaration>[
TypeDeclaration(baseName: 'int', isNullable: true)
]),
- name: 'arg',
- offset: null)
+ name: 'arg')
])
])
],
@@ -805,7 +763,6 @@
const TypeDeclaration(isNullable: false, baseName: 'int')),
],
returnType: const TypeDeclaration(baseName: 'int', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[], enums: <Enum>[]);
@@ -837,7 +794,6 @@
const TypeDeclaration(baseName: 'int', isNullable: false)),
],
returnType: const TypeDeclaration(baseName: 'int', isNullable: false),
- isAsynchronous: false,
)
])
], classes: <Class>[], enums: <Enum>[]);
@@ -970,11 +926,9 @@
baseName: 'Input',
isNullable: false,
),
- name: '',
- offset: null)
+ name: '')
],
returnType: const TypeDeclaration.voidDeclaration(),
- isAsynchronous: false,
)
])
], classes: <Class>[
@@ -984,8 +938,7 @@
baseName: 'String',
isNullable: false,
),
- name: 'input',
- offset: null)
+ name: 'input')
]),
], enums: <Enum>[]);
final StringBuffer sink = StringBuffer();
diff --git a/packages/pigeon/tool/run_tests.dart b/packages/pigeon/tool/run_tests.dart
index 35d9851..cfb742b 100644
--- a/packages/pigeon/tool/run_tests.dart
+++ b/packages/pigeon/tool/run_tests.dart
@@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// ignore_for_file: avoid_print
+
////////////////////////////////////////////////////////////////////////////////
/// Script for executing the Pigeon tests
///
/// usage: dart run tool/run_tests.dart
////////////////////////////////////////////////////////////////////////////////
-import 'dart:io' show File, Process, Platform, exit, stderr, stdout;
+import 'dart:io' show File, Platform, Process, exit, stderr, stdout;
import 'package:args/args.dart';
import 'package:meta/meta.dart';
import 'package:pigeon/functional.dart';
@@ -34,7 +36,7 @@
description: 'Compilation tests on generated Dart code.'),
'dart_unittests': _TestInfo(
function: _runDartUnitTests,
- description: 'Unit tests on and analysis on Pigeon\'s implementation.'),
+ description: "Unit tests on and analysis on Pigeon's implementation."),
'flutter_unittests': _TestInfo(
function: _runFlutterUnitTests,
description: 'Unit tests on generated Dart code.'),
@@ -121,7 +123,6 @@
input: 'pigeons/message.dart',
dartOut: messagePath,
dartTestOut: messageTestPath,
- streamOutput: true,
);
if (generateTestCode != 0) {
return generateTestCode;
@@ -400,7 +401,7 @@
print('available tests:');
for (final MapEntry<String, _TestInfo> info in _tests.entries) {
final int tabCount = (4 - info.key.length / 8).toInt();
- final String tabs = repeat('\t', tabCount).join('');
+ final String tabs = repeat('\t', tabCount).join();
print('${info.key}$tabs- ${info.value.description}');
}
exit(0);
diff --git a/packages/pointer_interceptor/CHANGELOG.md b/packages/pointer_interceptor/CHANGELOG.md
index 642174c..35f8291 100644
--- a/packages/pointer_interceptor/CHANGELOG.md
+++ b/packages/pointer_interceptor/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.9.3+3
+
+* Fixes lint warnings.
+
## 0.9.3+2
* (Temporarily) helps tests introduced in prior version to pass in `stable`.
diff --git a/packages/pointer_interceptor/example/integration_test/widget_test.dart b/packages/pointer_interceptor/example/integration_test/widget_test.dart
index aa77765..c8d5d6f 100644
--- a/packages/pointer_interceptor/example/integration_test/widget_test.dart
+++ b/packages/pointer_interceptor/example/integration_test/widget_test.dart
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// ignore_for_file: avoid_print
+
import 'dart:html' as html;
// Imports the Flutter Driver API.
diff --git a/packages/pointer_interceptor/example/lib/main.dart b/packages/pointer_interceptor/example/lib/main.dart
index b30ea01..9e759f3 100644
--- a/packages/pointer_interceptor/example/lib/main.dart
+++ b/packages/pointer_interceptor/example/lib/main.dart
@@ -70,7 +70,7 @@
const MyHomePage({Key? key}) : super(key: key);
@override
- _MyHomePageState createState() => _MyHomePageState();
+ State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@@ -205,7 +205,7 @@
const HtmlElement({Key? key, required this.onClick}) : super(key: key);
/// A function to run when the element is clicked
- final Function onClick;
+ final VoidCallback onClick;
@override
Widget build(BuildContext context) {
diff --git a/packages/pointer_interceptor/pubspec.yaml b/packages/pointer_interceptor/pubspec.yaml
index e26e12b..259b80a 100644
--- a/packages/pointer_interceptor/pubspec.yaml
+++ b/packages/pointer_interceptor/pubspec.yaml
@@ -2,7 +2,7 @@
description: A widget to prevent clicks from being swallowed by underlying HtmlElementViews on the web.
repository: https://github.com/flutter/packages/tree/main/packages/pointer_interceptor
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+pointer_interceptor%22
-version: 0.9.3+2
+version: 0.9.3+3
environment:
sdk: ">=2.12.0 <3.0.0"
diff --git a/packages/pointer_interceptor/test/tests_exist_elsewhere_test.dart b/packages/pointer_interceptor/test/tests_exist_elsewhere_test.dart
index 442c501..cc32e6c 100644
--- a/packages/pointer_interceptor/test/tests_exist_elsewhere_test.dart
+++ b/packages/pointer_interceptor/test/tests_exist_elsewhere_test.dart
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// ignore_for_file: avoid_print
+
import 'package:flutter_test/flutter_test.dart';
void main() {
diff --git a/packages/rfw/CHANGELOG.md b/packages/rfw/CHANGELOG.md
index c0a98f1..2d1bddc 100644
--- a/packages/rfw/CHANGELOG.md
+++ b/packages/rfw/CHANGELOG.md
@@ -1,7 +1,8 @@
-## NEXT
+## 1.0.6
* Temporarily lowers test coverage minimum to fix flutter roll.
-* Disable golden testing due to https://github.com/flutter/flutter/issues/106205
+* Disables golden testing due to https://github.com/flutter/flutter/issues/106205.
+* Fixes lint warnings.
## 1.0.5
diff --git a/packages/rfw/example/remote/lib/main.dart b/packages/rfw/example/remote/lib/main.dart
index f1d5fbe..646423e 100644
--- a/packages/rfw/example/remote/lib/main.dart
+++ b/packages/rfw/example/remote/lib/main.dart
@@ -65,7 +65,7 @@
FlutterError.reportError(FlutterErrorDetails(exception: e, stack: stack));
}
}
- print('Fetching: $urlPrefix/$nextFile');
+ print('Fetching: $urlPrefix/$nextFile'); // ignore: avoid_print
final HttpClientResponse client = await (await HttpClient().getUrl(Uri.parse('$urlPrefix/$nextFile'))).close();
await currentFile.writeAsBytes(await client.expand((List<int> chunk) => chunk).toList());
await settingsFile.writeAsString(nextFile);
diff --git a/packages/rfw/example/wasm/lib/main.dart b/packages/rfw/example/wasm/lib/main.dart
index a0dd80a..181fb18 100644
--- a/packages/rfw/example/wasm/lib/main.dart
+++ b/packages/rfw/example/wasm/lib/main.dart
@@ -71,15 +71,17 @@
}
List<Object?> _asList(Object? value) {
- if (value is List<Object?>)
+ if (value is List<Object?>) {
return value;
+ }
return const <Object?>[];
}
@override
Widget build(BuildContext context) {
- if (!RendererBinding.instance.sendFramesToEngine)
+ if (!RendererBinding.instance.sendFramesToEngine) {
return const SizedBox.shrink();
+ }
return RemoteWidget(
runtime: _runtime,
data: _data,
diff --git a/packages/rfw/example/wasm/logic/encode.dart b/packages/rfw/example/wasm/logic/encode.dart
index 610c0b6..f4d16a7 100644
--- a/packages/rfw/example/wasm/logic/encode.dart
+++ b/packages/rfw/example/wasm/logic/encode.dart
@@ -8,6 +8,7 @@
void main(List<String> arguments) {
if (arguments.length != 2) {
+ // ignore: avoid_print
print('usage: dart encode.dart source.rfwtxt output.rfw');
exit(1);
}
diff --git a/packages/rfw/lib/src/flutter/core_widgets.dart b/packages/rfw/lib/src/flutter/core_widgets.dart
index 26c4cbe..0ff1b12 100644
--- a/packages/rfw/lib/src/flutter/core_widgets.dart
+++ b/packages/rfw/lib/src/flutter/core_widgets.dart
@@ -248,8 +248,8 @@
alignment: ArgumentDecoders.alignment(source, ['alignment']) ?? Alignment.center,
widthFactor: source.v<double>(['widthFactor']),
heightFactor: source.v<double>(['heightFactor']),
- child: source.optionalChild(['child']),
onEnd: source.voidHandler(['onEnd']),
+ child: source.optionalChild(['child']),
);
},
@@ -302,9 +302,9 @@
margin: ArgumentDecoders.edgeInsets(source, ['margin']),
transform: ArgumentDecoders.matrix(source, ['transform']),
transformAlignment: ArgumentDecoders.alignment(source, ['transformAlignment']),
- child: source.optionalChild(['child']),
clipBehavior: ArgumentDecoders.enumValue<Clip>(Clip.values, source, ['clipBehavior']) ?? Clip.none,
onEnd: source.voidHandler(['onEnd']),
+ child: source.optionalChild(['child']),
);
},
@@ -319,8 +319,8 @@
maxLines: source.v<int>(['maxLines']),
textWidthBasis: ArgumentDecoders.enumValue<TextWidthBasis>(TextWidthBasis.values, source, ['textWidthBasis']) ?? TextWidthBasis.parent,
textHeightBehavior: ArgumentDecoders.textHeightBehavior(source, ['textHeightBehavior']),
- child: source.child(['child']),
onEnd: source.voidHandler(['onEnd']),
+ child: source.child(['child']),
);
},
@@ -496,8 +496,8 @@
duration: ArgumentDecoders.duration(source, ['duration'], context),
curve: ArgumentDecoders.curve(source, ['curve'], context),
padding: ArgumentDecoders.edgeInsets(source, ['padding']) ?? EdgeInsets.zero,
- child: source.optionalChild(['child']),
onEnd: source.voidHandler(['onEnd']),
+ child: source.optionalChild(['child']),
);
},
@@ -520,8 +520,8 @@
bottom: source.v<double>(['bottom']),
width: source.v<double>(['width']),
height: source.v<double>(['height']),
- child: source.child(['child']),
onEnd: source.voidHandler(['onEnd']),
+ child: source.child(['child']),
);
},
@@ -532,8 +532,8 @@
turns: source.v<double>(['turns']) ?? 0.0,
alignment: (ArgumentDecoders.alignment(source, ['alignment']) ?? Alignment.center).resolve(Directionality.of(context)),
filterQuality: ArgumentDecoders.enumValue<FilterQuality>(FilterQuality.values, source, ['filterQuality']),
- child: source.optionalChild(['child']),
onEnd: source.voidHandler(['onEnd']),
+ child: source.optionalChild(['child']),
);
},
@@ -568,8 +568,8 @@
scale: source.v<double>(['scale']) ?? 1.0,
alignment: (ArgumentDecoders.alignment(source, ['alignment']) ?? Alignment.center).resolve(Directionality.of(context)),
filterQuality: ArgumentDecoders.enumValue<FilterQuality>(FilterQuality.values, source, ['filterQuality']),
- child: source.optionalChild(['child']),
onEnd: source.voidHandler(['onEnd']),
+ child: source.optionalChild(['child']),
);
},
@@ -579,13 +579,13 @@
reverse: source.v<bool>(['reverse']) ?? false,
padding: ArgumentDecoders.edgeInsets(source, ['padding']),
primary: source.v<bool>(['primary']) ?? true,
- // ScrollPhysics? physics,
- // ScrollController? controller,
- child: source.optionalChild(['child']),
dragStartBehavior: ArgumentDecoders.enumValue<DragStartBehavior>(DragStartBehavior.values, source, ['dragStartBehavior']) ?? DragStartBehavior.start,
clipBehavior: ArgumentDecoders.enumValue<Clip>(Clip.values, source, ['clipBehavior']) ?? Clip.hardEdge,
restorationId: source.v<String>(['restorationId']),
keyboardDismissBehavior: ArgumentDecoders.enumValue<ScrollViewKeyboardDismissBehavior>(ScrollViewKeyboardDismissBehavior.values, source, ['keyboardDismissBehavior']) ?? ScrollViewKeyboardDismissBehavior.manual,
+ // ScrollPhysics? physics,
+ // ScrollController? controller,
+ child: source.optionalChild(['child']),
);
},
diff --git a/packages/rfw/lib/src/flutter/material_widgets.dart b/packages/rfw/lib/src/flutter/material_widgets.dart
index 382627e..00a721b 100644
--- a/packages/rfw/lib/src/flutter/material_widgets.dart
+++ b/packages/rfw/lib/src/flutter/material_widgets.dart
@@ -81,13 +81,13 @@
'AboutListTile': (BuildContext context, DataSource source) {
return AboutListTile(
icon: source.optionalChild(['icon']),
- child: source.optionalChild(['child']),
applicationName: source.v<String>(['applicationName']),
applicationVersion: source.v<String>(['applicationVersion']),
applicationIcon: source.optionalChild(['applicationIcon']),
applicationLegalese: source.v<String>(['applicationLegalese']),
aboutBoxChildren: source.childList(['aboutBoxChildren']),
dense: source.v<bool>(['dense']),
+ child: source.optionalChild(['child']),
);
},
@@ -142,8 +142,8 @@
borderOnForeground: source.v<bool>(['borderOnForeground']) ?? true,
margin: ArgumentDecoders.edgeInsets(source, ['margin']),
clipBehavior: ArgumentDecoders.enumValue<Clip>(Clip.values, source, ['clipBehavior']) ?? Clip.none,
- child: source.optionalChild(['child']),
semanticContainer: source.v<bool>(['semanticContainer']) ?? true,
+ child: source.optionalChild(['child']),
);
},
@@ -202,7 +202,6 @@
'FloatingActionButton': (BuildContext context, DataSource source) {
// not implemented: mouseCursor, focusNode
return FloatingActionButton(
- child: source.child(['child']),
tooltip: source.v<String>(['tooltip']),
foregroundColor: ArgumentDecoders.color(source, ['foregroundColor']),
backgroundColor: ArgumentDecoders.color(source, ['backgroundColor']),
@@ -223,6 +222,7 @@
materialTapTargetSize: ArgumentDecoders.enumValue<MaterialTapTargetSize>(MaterialTapTargetSize.values, source, ['materialTapTargetSize']),
isExtended: source.v<bool>(['isExtended']) ?? false,
enableFeedback: source.v<bool>(['enableFeedback']),
+ child: source.child(['child']),
);
},
diff --git a/packages/rfw/lib/src/flutter/remote_widget.dart b/packages/rfw/lib/src/flutter/remote_widget.dart
index 7dd0d5c..83a571c 100644
--- a/packages/rfw/lib/src/flutter/remote_widget.dart
+++ b/packages/rfw/lib/src/flutter/remote_widget.dart
@@ -57,7 +57,7 @@
final RemoteEventHandler? onEvent;
@override
- _RemoteWidgetState createState() => _RemoteWidgetState();
+ State<RemoteWidget> createState() => _RemoteWidgetState();
}
class _RemoteWidgetState extends State<RemoteWidget> {
diff --git a/packages/rfw/pubspec.yaml b/packages/rfw/pubspec.yaml
index 6ac9778..577aabb 100644
--- a/packages/rfw/pubspec.yaml
+++ b/packages/rfw/pubspec.yaml
@@ -2,7 +2,7 @@
description: "Remote Flutter widgets: a library for rendering declarative widget description files at runtime."
repository: https://github.com/flutter/packages/tree/main/packages/rfw
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+rfw%22
-version: 1.0.5
+version: 1.0.6
environment:
sdk: ">=2.13.0 <3.0.0"
diff --git a/packages/rfw/test/binary_test.dart b/packages/rfw/test/binary_test.dart
index de8921c..207f706 100644
--- a/packages/rfw/test/binary_test.dart
+++ b/packages/rfw/test/binary_test.dart
@@ -450,7 +450,7 @@
expect(value.widgets, hasLength(1));
expect(value.widgets.first.name, 'a');
expect(value.widgets.first.initialState, isNotNull);
- expect(value.widgets.first.initialState!, hasLength(1));
+ expect(value.widgets.first.initialState, hasLength(1));
expect(value.widgets.first.initialState!['b'], false);
expect(value.widgets.first.root, isA<ConstructorCall>());
expect((value.widgets.first.root as ConstructorCall).name, 'c');
diff --git a/packages/rfw/test/core_widgets_test.dart b/packages/rfw/test/core_widgets_test.dart
index 317c618..8765e13 100644
--- a/packages/rfw/test/core_widgets_test.dart
+++ b/packages/rfw/test/core_widgets_test.dart
@@ -202,7 +202,7 @@
);
'''));
await tester.pump();
- expect(tester.getTopLeft(find.byType(SizedBox)), const Offset(0.0, 0.0));
+ expect(tester.getTopLeft(find.byType(SizedBox)), Offset.zero);
runtime.update(const LibraryName(<String>['test']), parseLibraryFile('''
import core;
diff --git a/packages/rfw/test/runtime_test.dart b/packages/rfw/test/runtime_test.dart
index 0e3f476..609b6e2 100644
--- a/packages/rfw/test/runtime_test.dart
+++ b/packages/rfw/test/runtime_test.dart
@@ -4,6 +4,8 @@
// This file is hand-formatted.
+// ignore_for_file: avoid_dynamic_calls
+
import 'dart:convert';
import 'dart:typed_data';
diff --git a/packages/rfw/test_coverage/bin/test_coverage.dart b/packages/rfw/test_coverage/bin/test_coverage.dart
index 5ed9b1b..488da7c 100644
--- a/packages/rfw/test_coverage/bin/test_coverage.dart
+++ b/packages/rfw/test_coverage/bin/test_coverage.dart
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// ignore_for_file: avoid_print
+
import 'dart:io';
import 'package:lcov_parser/lcov_parser.dart' as lcov;
diff --git a/packages/standard_message_codec/CHANGELOG.md b/packages/standard_message_codec/CHANGELOG.md
index d1108d5..e3a9a0a 100644
--- a/packages/standard_message_codec/CHANGELOG.md
+++ b/packages/standard_message_codec/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.0.1+2
+
+* Fixes lint warnings.
+
## 0.0.1+1
* Fixes minimum version of `test` dependency.
diff --git a/packages/standard_message_codec/example/lib/readme_excerpts.dart b/packages/standard_message_codec/example/lib/readme_excerpts.dart
index f2d4412..ea70bc2 100644
--- a/packages/standard_message_codec/example/lib/readme_excerpts.dart
+++ b/packages/standard_message_codec/example/lib/readme_excerpts.dart
@@ -5,6 +5,8 @@
// This file exists solely to host compiled excerpts for README.md, and is not
// intended for use as an actual example application.
+// ignore_for_file: avoid_print
+
// #docregion Encoding
import 'dart:typed_data';
import 'package:standard_message_codec/standard_message_codec.dart';
diff --git a/packages/standard_message_codec/lib/standard_message_codec.dart b/packages/standard_message_codec/lib/standard_message_codec.dart
index 3ecddf4..cdb70fe 100644
--- a/packages/standard_message_codec/lib/standard_message_codec.dart
+++ b/packages/standard_message_codec/lib/standard_message_codec.dart
@@ -230,8 +230,8 @@
// decoding because we use tags to detect the type of value.
buffer.putUint8(_valueFloat64);
buffer.putFloat64(value);
- } else if (value is int) {
// ignore: avoid_double_and_int_checks, JS code always goes through the `double` path above
+ } else if (value is int) {
if (-0x7fffffff - 1 <= value && value <= 0x7fffffff) {
buffer.putUint8(_valueInt32);
buffer.putInt32(value);
diff --git a/packages/standard_message_codec/pubspec.yaml b/packages/standard_message_codec/pubspec.yaml
index dccca1f..235f502 100644
--- a/packages/standard_message_codec/pubspec.yaml
+++ b/packages/standard_message_codec/pubspec.yaml
@@ -1,6 +1,6 @@
name: standard_message_codec
description: An efficient and schemaless binary encoding format for Flutter and Dart.
-version: 0.0.1+1
+version: 0.0.1+2
repository: https://github.com/flutter/packages/tree/main/packages/standard_message_codec
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3Astandard_message_codec
diff --git a/packages/web_benchmarks/CHANGELOG.md b/packages/web_benchmarks/CHANGELOG.md
index 13e6cfd..d7edff7 100644
--- a/packages/web_benchmarks/CHANGELOG.md
+++ b/packages/web_benchmarks/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.1.0+1
+
+* Fixes lint warnings.
+
## 0.1.0
* Migrates to null safety.
diff --git a/packages/web_benchmarks/lib/client.dart b/packages/web_benchmarks/lib/client.dart
index ae0c453..6676dc8 100644
--- a/packages/web_benchmarks/lib/client.dart
+++ b/packages/web_benchmarks/lib/client.dart
@@ -73,7 +73,7 @@
await _client.sendProfileData(profile);
} else {
_printResultsToScreen(profile);
- print(profile);
+ print(profile); // ignore: avoid_print
}
},
zoneSpecification: ZoneSpecification(
@@ -133,14 +133,14 @@
/// Visualizes results on the Web page for manual inspection.
void _printResultsToScreen(Profile profile) {
- final html.BodyElement _body = html.document.body!;
+ final html.BodyElement body = html.document.body!;
- _body.innerHtml = '<h2>${profile.name}</h2>';
+ body.innerHtml = '<h2>${profile.name}</h2>';
profile.scoreData.forEach((String scoreKey, Timeseries timeseries) {
- _body.appendHtml('<h2>$scoreKey</h2>');
- _body.appendHtml('<pre>${timeseries.computeStats()}</pre>');
- _body.append(TimeseriesVisualization(timeseries).render());
+ body.appendHtml('<h2>$scoreKey</h2>');
+ body.appendHtml('<pre>${timeseries.computeStats()}</pre>');
+ body.append(TimeseriesVisualization(timeseries).render());
});
}
diff --git a/packages/web_benchmarks/lib/src/browser.dart b/packages/web_benchmarks/lib/src/browser.dart
index b6b9cf5..52b31d6 100644
--- a/packages/web_benchmarks/lib/src/browser.dart
+++ b/packages/web_benchmarks/lib/src/browser.dart
@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// ignore_for_file: avoid_print, avoid_dynamic_calls
+
import 'dart:async';
-import 'dart:convert' show json, utf8, LineSplitter, JsonEncoder;
+import 'dart:convert' show JsonEncoder, LineSplitter, json, utf8;
import 'dart:io' as io;
import 'dart:math' as math;
@@ -327,7 +329,7 @@
Exception noMeasuredFramesFound() => Exception(
'No measured frames found in benchmark tracing data. This likely '
'indicates a bug in the benchmark. For example, the benchmark failed '
- 'to pump enough frames. It may also indicate a change in Chrome\'s '
+ "to pump enough frames. It may also indicate a change in Chrome's "
'tracing data format. Check if Chrome version changed recently and '
'adjust the parsing code accordingly.',
);
@@ -396,7 +398,7 @@
.whereType<BlinkTraceEvent>()
.toList()),
);
- } catch (_, __) {
+ } catch (_) {
final io.File traceFile = io.File('./chrome-trace.json');
io.stderr.writeln(
'Failed to interpret the Chrome trace contents. The trace was saved in ${traceFile.path}');
@@ -454,11 +456,11 @@
final double sum = events
.skip(math.max(events.length - kMeasuredSampleCount, 0))
.fold(0.0, (double previousValue, BlinkTraceEvent event) {
- final int? _threadClockDuration = event.tdur;
- if (_threadClockDuration == null) {
+ final int? threadClockDuration = event.tdur;
+ if (threadClockDuration == null) {
throw FormatException('Trace event lacks "tdur" field: $event');
}
- return previousValue + _threadClockDuration;
+ return previousValue + threadClockDuration;
});
final int sampleCount = math.min(events.length, kMeasuredSampleCount);
return Duration(microseconds: sum ~/ sampleCount);
@@ -614,7 +616,7 @@
final num? jsonValue = json[key];
if (jsonValue == null) {
- return null;
+ return null; // ignore: avoid_returning_null
}
return jsonValue.toInt();
diff --git a/packages/web_benchmarks/lib/src/runner.dart b/packages/web_benchmarks/lib/src/runner.dart
index 3c9dd72..68c09f8 100644
--- a/packages/web_benchmarks/lib/src/runner.dart
+++ b/packages/web_benchmarks/lib/src/runner.dart
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// ignore_for_file: avoid_print
+
import 'dart:async';
import 'dart:convert' show json;
import 'dart:io' as io;
@@ -89,7 +91,7 @@
if (!_processManager.canRun('flutter')) {
throw Exception(
- 'flutter executable is not runnable. Make sure it\'s in the PATH.');
+ "flutter executable is not runnable. Make sure it's in the PATH.");
}
final io.ProcessResult buildResult = await _processManager.run(
@@ -160,7 +162,7 @@
traceSummary?.averageTotalUIFrameTime.inMicroseconds;
profile['scoreKeys'] ??=
<dynamic>[]; // using dynamic for consistency with JSON
- profile['scoreKeys'].add('totalUiFrame.average');
+ (profile['scoreKeys'] as List<dynamic>).add('totalUiFrame.average');
latestPerformanceTrace = null;
}
collectedProfiles.add(profile);
@@ -191,7 +193,8 @@
} else if (request.requestedUri.path.endsWith('/next-benchmark')) {
if (benchmarks == null) {
benchmarks =
- (json.decode(await request.readAsString())).cast<String>();
+ (json.decode(await request.readAsString()) as List<dynamic>)
+ .cast<String>();
benchmarkIterator = benchmarks!.iterator;
}
if (benchmarkIterator.moveNext()) {
@@ -244,8 +247,6 @@
final ChromeOptions options = ChromeOptions(
url: 'http://localhost:$benchmarkServerPort/index.html',
userDataDirectory: userDataDir,
- windowHeight: 1024,
- windowWidth: 1024,
headless: headless,
debugPort: chromeDebugPort,
);
@@ -272,17 +273,18 @@
for (final Map<String, dynamic> profile in profiles) {
final String benchmarkName = profile['name'];
if (benchmarkName.isEmpty) {
- throw 'Benchmark name is empty';
+ throw StateError('Benchmark name is empty');
}
final List<String> scoreKeys = List<String>.from(profile['scoreKeys']);
if (scoreKeys == null || scoreKeys.isEmpty) {
- throw 'No score keys in benchmark "$benchmarkName"';
+ throw StateError('No score keys in benchmark "$benchmarkName"');
}
for (final String scoreKey in scoreKeys) {
if (scoreKey == null || scoreKey.isEmpty) {
- throw 'Score key is empty in benchmark "$benchmarkName". '
- 'Received [${scoreKeys.join(', ')}]';
+ throw StateError(
+ 'Score key is empty in benchmark "$benchmarkName". '
+ 'Received [${scoreKeys.join(', ')}]');
}
}
diff --git a/packages/web_benchmarks/pubspec.yaml b/packages/web_benchmarks/pubspec.yaml
index b82a743..459a2a6 100644
--- a/packages/web_benchmarks/pubspec.yaml
+++ b/packages/web_benchmarks/pubspec.yaml
@@ -2,7 +2,7 @@
description: A benchmark harness for performance-testing Flutter apps in Chrome.
repository: https://github.com/flutter/packages/tree/main/packages/web_benchmarks
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+web_benchmarks%22
-version: 0.1.0
+version: 0.1.0+1
environment:
sdk: '>=2.17.0 <3.0.0'
diff --git a/packages/web_benchmarks/test/more_tests_in_testing_dir_test.dart b/packages/web_benchmarks/test/more_tests_in_testing_dir_test.dart
index d7c658c..53387e1 100644
--- a/packages/web_benchmarks/test/more_tests_in_testing_dir_test.dart
+++ b/packages/web_benchmarks/test/more_tests_in_testing_dir_test.dart
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// ignore_for_file: avoid_print
+
import 'package:flutter_test/flutter_test.dart';
void main() {
diff --git a/packages/web_benchmarks/testing/test_app/lib/aboutpage.dart b/packages/web_benchmarks/testing/test_app/lib/aboutpage.dart
index ebe5271..4147c33 100644
--- a/packages/web_benchmarks/testing/test_app/lib/aboutpage.dart
+++ b/packages/web_benchmarks/testing/test_app/lib/aboutpage.dart
@@ -7,7 +7,7 @@
const ValueKey<String> backKey = ValueKey<String>('backKey');
class AboutPage extends StatelessWidget {
- const AboutPage({Key? key}) : super(key: key);
+ const AboutPage({super.key});
@override
Widget build(BuildContext context) {
diff --git a/packages/web_benchmarks/testing/test_app/lib/benchmarks/runner.dart b/packages/web_benchmarks/testing/test_app/lib/benchmarks/runner.dart
index c8f340e..9d3a59d 100644
--- a/packages/web_benchmarks/testing/test_app/lib/benchmarks/runner.dart
+++ b/packages/web_benchmarks/testing/test_app/lib/benchmarks/runner.dart
@@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// ignore_for_file: avoid_print
+
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:web_benchmarks/client.dart';
import '../aboutpage.dart' show backKey;
-import '../homepage.dart' show textKey, aboutPageKey;
+import '../homepage.dart' show aboutPageKey, textKey;
import '../main.dart';
/// A recorder that measures frame building durations.
diff --git a/packages/web_benchmarks/testing/test_app/lib/homepage.dart b/packages/web_benchmarks/testing/test_app/lib/homepage.dart
index 7343713..dee8c9d 100644
--- a/packages/web_benchmarks/testing/test_app/lib/homepage.dart
+++ b/packages/web_benchmarks/testing/test_app/lib/homepage.dart
@@ -8,12 +8,12 @@
const ValueKey<String> aboutPageKey = ValueKey<String>('aboutPageKey');
class HomePage extends StatefulWidget {
- const HomePage({Key? key, required this.title}) : super(key: key);
+ const HomePage({super.key, required this.title});
final String title;
@override
- _HomePageState createState() => _HomePageState();
+ State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
@@ -63,7 +63,6 @@
elevation: 8,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
'Line $index',
diff --git a/packages/web_benchmarks/testing/test_app/lib/main.dart b/packages/web_benchmarks/testing/test_app/lib/main.dart
index 8607bf3..5621621 100644
--- a/packages/web_benchmarks/testing/test_app/lib/main.dart
+++ b/packages/web_benchmarks/testing/test_app/lib/main.dart
@@ -12,7 +12,7 @@
}
class MyApp extends StatelessWidget {
- const MyApp({Key? key}) : super(key: key);
+ const MyApp({super.key});
@override
Widget build(BuildContext context) {
diff --git a/packages/web_benchmarks/testing/test_app/pubspec.yaml b/packages/web_benchmarks/testing/test_app/pubspec.yaml
index 3a124ba..eb67139 100644
--- a/packages/web_benchmarks/testing/test_app/pubspec.yaml
+++ b/packages/web_benchmarks/testing/test_app/pubspec.yaml
@@ -12,12 +12,10 @@
cupertino_icons: ^0.1.3
flutter:
sdk: flutter
- web_benchmarks:
- path: ../../
-
-dev_dependencies:
flutter_test:
sdk: flutter
+ web_benchmarks:
+ path: ../../
flutter:
uses-material-design: true
diff --git a/packages/xdg_directories/CHANGELOG.md b/packages/xdg_directories/CHANGELOG.md
index ced4c1a..ec5bb29 100644
--- a/packages/xdg_directories/CHANGELOG.md
+++ b/packages/xdg_directories/CHANGELOG.md
@@ -1,6 +1,7 @@
-## NEXT
+## 0.2.0+2
* Fixes unit tests on Windows.
+* Fixes lint warnings.
## 0.2.0+1
diff --git a/packages/xdg_directories/lib/xdg_directories.dart b/packages/xdg_directories/lib/xdg_directories.dart
index c5ae57f..2192153 100644
--- a/packages/xdg_directories/lib/xdg_directories.dart
+++ b/packages/xdg_directories/lib/xdg_directories.dart
@@ -152,7 +152,6 @@
Directory? getUserDirectory(String dirName) {
final ProcessResult result = _processManager.runSync(
<String>['xdg-user-dir', dirName],
- includeParentEnvironment: true,
stdoutEncoding: utf8,
);
final String path = (result.stdout as String).split('\n')[0];
diff --git a/packages/xdg_directories/pubspec.yaml b/packages/xdg_directories/pubspec.yaml
index 11b01bd..8edfad1 100644
--- a/packages/xdg_directories/pubspec.yaml
+++ b/packages/xdg_directories/pubspec.yaml
@@ -2,7 +2,7 @@
description: A Dart package for reading XDG directory configuration information on Linux.
repository: https://github.com/flutter/packages/tree/main/packages/xdg_directories
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+xdg_directories%22
-version: 0.2.0+1
+version: 0.2.0+2
environment:
sdk: ">=2.12.0 <3.0.0"
diff --git a/packages/xdg_directories/test/xdg_directories_test.dart b/packages/xdg_directories/test/xdg_directories_test.dart
index 7bcb4ca..800b0b6 100644
--- a/packages/xdg_directories/test/xdg_directories_test.dart
+++ b/packages/xdg_directories/test/xdg_directories_test.dart
@@ -136,6 +136,6 @@
Encoding stdoutEncoding = systemEncoding,
Encoding stderrEncoding = systemEncoding,
}) {
- return ProcessResult(0, 0, expected[command[1]]!, '');
+ return ProcessResult(0, 0, expected[command[1]], '');
}
}