diff --git a/add_to_app/android_view/flutter_module_using_plugin/analysis_options.yaml b/add_to_app/android_view/flutter_module_using_plugin/analysis_options.yaml index 85f6fbe91..e2badd73e 100644 --- a/add_to_app/android_view/flutter_module_using_plugin/analysis_options.yaml +++ b/add_to_app/android_view/flutter_module_using_plugin/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../../../analysis_options.yaml diff --git a/add_to_app/books/flutter_module_books/analysis_options.yaml b/add_to_app/books/flutter_module_books/analysis_options.yaml index 85f6fbe91..e2badd73e 100644 --- a/add_to_app/books/flutter_module_books/analysis_options.yaml +++ b/add_to_app/books/flutter_module_books/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../../../analysis_options.yaml diff --git a/add_to_app/fullscreen/flutter_module/analysis_options.yaml b/add_to_app/fullscreen/flutter_module/analysis_options.yaml index 85f6fbe91..e2badd73e 100644 --- a/add_to_app/fullscreen/flutter_module/analysis_options.yaml +++ b/add_to_app/fullscreen/flutter_module/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../../../analysis_options.yaml diff --git a/add_to_app/multiple_flutters/multiple_flutters_module/analysis_options.yaml b/add_to_app/multiple_flutters/multiple_flutters_module/analysis_options.yaml index 85f6fbe91..e2badd73e 100644 --- a/add_to_app/multiple_flutters/multiple_flutters_module/analysis_options.yaml +++ b/add_to_app/multiple_flutters/multiple_flutters_module/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../../../analysis_options.yaml diff --git a/add_to_app/plugin/flutter_module_using_plugin/analysis_options.yaml b/add_to_app/plugin/flutter_module_using_plugin/analysis_options.yaml index 85f6fbe91..e2badd73e 100644 --- a/add_to_app/plugin/flutter_module_using_plugin/analysis_options.yaml +++ b/add_to_app/plugin/flutter_module_using_plugin/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../../../analysis_options.yaml diff --git a/add_to_app/prebuilt_module/flutter_module/analysis_options.yaml b/add_to_app/prebuilt_module/flutter_module/analysis_options.yaml index 85f6fbe91..e2badd73e 100644 --- a/add_to_app/prebuilt_module/flutter_module/analysis_options.yaml +++ b/add_to_app/prebuilt_module/flutter_module/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../../../analysis_options.yaml diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 000000000..85f6fbe91 --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,19 @@ +include: package:flutter_lints/flutter.yaml + +analyzer: + strong-mode: + implicit-casts: false + implicit-dynamic: false + +linter: + rules: + avoid_types_on_closure_parameters: true + avoid_void_async: true + cancel_subscriptions: true + close_sinks: true + directives_ordering: true + package_api_docs: true + package_prefixed_library_names: true + test_types_in_equals: true + throw_in_finally: true + unnecessary_statements: true diff --git a/android_splash_screen/analysis_options.yaml b/android_splash_screen/analysis_options.yaml index 85f6fbe91..5e2133eb6 100644 --- a/android_splash_screen/analysis_options.yaml +++ b/android_splash_screen/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../analysis_options.yaml diff --git a/animations/analysis_options.yaml b/animations/analysis_options.yaml index b1d37f49e..2b0c0f079 100644 --- a/animations/analysis_options.yaml +++ b/animations/analysis_options.yaml @@ -1,21 +1,6 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false +include: ../analysis_options.yaml linter: rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true # Required because of the numbered sources in lib/src/basics file_names: false - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true diff --git a/experimental/desktop_photo_search/analysis_options.yaml b/experimental/desktop_photo_search/analysis_options.yaml index 85f6fbe91..f04c6cf0f 100644 --- a/experimental/desktop_photo_search/analysis_options.yaml +++ b/experimental/desktop_photo_search/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../../analysis_options.yaml diff --git a/experimental/federated_plugin/federated_plugin/analysis_options.yaml b/experimental/federated_plugin/federated_plugin/analysis_options.yaml index 85f6fbe91..e2badd73e 100644 --- a/experimental/federated_plugin/federated_plugin/analysis_options.yaml +++ b/experimental/federated_plugin/federated_plugin/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../../../analysis_options.yaml diff --git a/experimental/federated_plugin/federated_plugin_macos/analysis_options.yaml b/experimental/federated_plugin/federated_plugin_macos/analysis_options.yaml index 85f6fbe91..e2badd73e 100644 --- a/experimental/federated_plugin/federated_plugin_macos/analysis_options.yaml +++ b/experimental/federated_plugin/federated_plugin_macos/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../../../analysis_options.yaml diff --git a/experimental/federated_plugin/federated_plugin_platform_interface/analysis_options.yaml b/experimental/federated_plugin/federated_plugin_platform_interface/analysis_options.yaml index 85f6fbe91..e2badd73e 100644 --- a/experimental/federated_plugin/federated_plugin_platform_interface/analysis_options.yaml +++ b/experimental/federated_plugin/federated_plugin_platform_interface/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../../../analysis_options.yaml diff --git a/experimental/federated_plugin/federated_plugin_web/analysis_options.yaml b/experimental/federated_plugin/federated_plugin_web/analysis_options.yaml index 85f6fbe91..e2badd73e 100644 --- a/experimental/federated_plugin/federated_plugin_web/analysis_options.yaml +++ b/experimental/federated_plugin/federated_plugin_web/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../../../analysis_options.yaml diff --git a/experimental/federated_plugin/federated_plugin_windows/analysis_options.yaml b/experimental/federated_plugin/federated_plugin_windows/analysis_options.yaml index 85f6fbe91..e2badd73e 100644 --- a/experimental/federated_plugin/federated_plugin_windows/analysis_options.yaml +++ b/experimental/federated_plugin/federated_plugin_windows/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../../../analysis_options.yaml diff --git a/experimental/linting_tool/analysis_options.yaml b/experimental/linting_tool/analysis_options.yaml index 90eb0ad9f..93d518ac2 100644 --- a/experimental/linting_tool/analysis_options.yaml +++ b/experimental/linting_tool/analysis_options.yaml @@ -1,22 +1,6 @@ -include: package:flutter_lints/flutter.yaml +include: ../../analysis_options.yaml analyzer: exclude: - lib/model/rule.g.dart - test/widget_test.mocks.dart - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true diff --git a/experimental/web_dashboard/analysis_options.yaml b/experimental/web_dashboard/analysis_options.yaml index 85f6fbe91..f04c6cf0f 100644 --- a/experimental/web_dashboard/analysis_options.yaml +++ b/experimental/web_dashboard/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../../analysis_options.yaml diff --git a/flutter_maps_firestore/analysis_options.yaml b/flutter_maps_firestore/analysis_options.yaml index 85f6fbe91..5e2133eb6 100644 --- a/flutter_maps_firestore/analysis_options.yaml +++ b/flutter_maps_firestore/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../analysis_options.yaml diff --git a/form_app/analysis_options.yaml b/form_app/analysis_options.yaml index 85f6fbe91..5e2133eb6 100644 --- a/form_app/analysis_options.yaml +++ b/form_app/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../analysis_options.yaml diff --git a/infinite_list/analysis_options.yaml b/infinite_list/analysis_options.yaml index 85f6fbe91..5e2133eb6 100644 --- a/infinite_list/analysis_options.yaml +++ b/infinite_list/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../analysis_options.yaml diff --git a/ios_app_clip/analysis_options.yaml b/ios_app_clip/analysis_options.yaml index 85f6fbe91..5e2133eb6 100644 --- a/ios_app_clip/analysis_options.yaml +++ b/ios_app_clip/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../analysis_options.yaml diff --git a/isolate_example/analysis_options.yaml b/isolate_example/analysis_options.yaml index 85f6fbe91..5e2133eb6 100644 --- a/isolate_example/analysis_options.yaml +++ b/isolate_example/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../analysis_options.yaml diff --git a/jsonexample/analysis_options.yaml b/jsonexample/analysis_options.yaml index 689a0c7a9..d0b14af59 100644 --- a/jsonexample/analysis_options.yaml +++ b/jsonexample/analysis_options.yaml @@ -1,22 +1,6 @@ -include: package:flutter_lints/flutter.yaml +include: ../analysis_options.yaml analyzer: exclude: - lib/json_serializable/*.g.dart - lib/built_value/*.g.dart - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true diff --git a/navigation_and_routing/analysis_options.yaml b/navigation_and_routing/analysis_options.yaml index c87f668e0..5e2133eb6 100644 --- a/navigation_and_routing/analysis_options.yaml +++ b/navigation_and_routing/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true \ No newline at end of file +include: ../analysis_options.yaml diff --git a/null_safety/null_safe_app/analysis_options.yaml b/null_safety/null_safe_app/analysis_options.yaml index 85f6fbe91..f04c6cf0f 100644 --- a/null_safety/null_safe_app/analysis_options.yaml +++ b/null_safety/null_safe_app/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../../analysis_options.yaml diff --git a/null_safety/null_unsafe_app/analysis_options.yaml b/null_safety/null_unsafe_app/analysis_options.yaml index 85f6fbe91..f04c6cf0f 100644 --- a/null_safety/null_unsafe_app/analysis_options.yaml +++ b/null_safety/null_unsafe_app/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../../analysis_options.yaml diff --git a/place_tracker/analysis_options.yaml b/place_tracker/analysis_options.yaml index 85f6fbe91..5e2133eb6 100644 --- a/place_tracker/analysis_options.yaml +++ b/place_tracker/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../analysis_options.yaml diff --git a/platform_channels/analysis_options.yaml b/platform_channels/analysis_options.yaml index 85f6fbe91..5e2133eb6 100644 --- a/platform_channels/analysis_options.yaml +++ b/platform_channels/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../analysis_options.yaml diff --git a/platform_design/analysis_options.yaml b/platform_design/analysis_options.yaml index 85f6fbe91..5e2133eb6 100644 --- a/platform_design/analysis_options.yaml +++ b/platform_design/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../analysis_options.yaml diff --git a/platform_view_swift/analysis_options.yaml b/platform_view_swift/analysis_options.yaml index 85f6fbe91..5e2133eb6 100644 --- a/platform_view_swift/analysis_options.yaml +++ b/platform_view_swift/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../analysis_options.yaml diff --git a/provider_counter/analysis_options.yaml b/provider_counter/analysis_options.yaml index 85f6fbe91..5e2133eb6 100644 --- a/provider_counter/analysis_options.yaml +++ b/provider_counter/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../analysis_options.yaml diff --git a/provider_shopper/analysis_options.yaml b/provider_shopper/analysis_options.yaml index 85f6fbe91..5e2133eb6 100644 --- a/provider_shopper/analysis_options.yaml +++ b/provider_shopper/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../analysis_options.yaml diff --git a/testing_app/analysis_options.yaml b/testing_app/analysis_options.yaml index 85f6fbe91..5e2133eb6 100644 --- a/testing_app/analysis_options.yaml +++ b/testing_app/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../analysis_options.yaml diff --git a/veggieseasons/analysis_options.yaml b/veggieseasons/analysis_options.yaml index 85f6fbe91..5e2133eb6 100644 --- a/veggieseasons/analysis_options.yaml +++ b/veggieseasons/analysis_options.yaml @@ -1,19 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - strong-mode: - implicit-casts: false - implicit-dynamic: false - -linter: - rules: - avoid_types_on_closure_parameters: true - avoid_void_async: true - cancel_subscriptions: true - close_sinks: true - directives_ordering: true - package_api_docs: true - package_prefixed_library_names: true - test_types_in_equals: true - throw_in_finally: true - unnecessary_statements: true +include: ../analysis_options.yaml diff --git a/web/particle_background/analysis_options.yaml b/web/particle_background/analysis_options.yaml new file mode 100644 index 000000000..de149220e --- /dev/null +++ b/web/particle_background/analysis_options.yaml @@ -0,0 +1,11 @@ +include: ../../analysis_options.yaml + +analyzer: + strong-mode: + implicit-casts: true + implicit-dynamic: true + +linter: + rules: + constant_identifier_names: false + diff --git a/web/particle_background/lib/main.dart b/web/particle_background/lib/main.dart index a771df10e..6ba95bc3a 100644 --- a/web/particle_background/lib/main.dart +++ b/web/particle_background/lib/main.dart @@ -3,12 +3,14 @@ import 'dart:math'; import 'package:flutter/material.dart'; import 'package:particle_background/simple_animations_package.dart'; -void main() => runApp(ParticleApp()); +void main() => runApp(const ParticleApp()); class ParticleApp extends StatelessWidget { + const ParticleApp({Key? key}) : super(key: key); + @override Widget build(BuildContext context) { - return MaterialApp( + return const MaterialApp( home: Scaffold( body: ParticleBackgroundPage(), ), @@ -17,10 +19,12 @@ class ParticleApp extends StatelessWidget { } class ParticleBackgroundPage extends StatelessWidget { + const ParticleBackgroundPage({Key? key}) : super(key: key); + @override Widget build(BuildContext context) { return Stack( - children: [ + children: const [ Positioned.fill(child: AnimatedBackground()), Positioned.fill(child: Particles(30)), Positioned.fill(child: CenteredText()), @@ -32,7 +36,7 @@ class ParticleBackgroundPage extends StatelessWidget { class Particles extends StatefulWidget { final int numberOfParticles; - Particles(this.numberOfParticles); + const Particles(this.numberOfParticles, {key}) : super(key: key); @override _ParticlesState createState() => _ParticlesState(); @@ -54,7 +58,7 @@ class _ParticlesState extends State { @override Widget build(BuildContext context) { return Rendering( - startTime: Duration(seconds: 30), + startTime: const Duration(seconds: 30), onTick: _simulateParticles, builder: (context, time) { return CustomPaint( @@ -65,14 +69,16 @@ class _ParticlesState extends State { } _simulateParticles(Duration time) { - particles.forEach((particle) => particle.maintainRestart(time)); + for (var particle in particles) { + particle.maintainRestart(time); + } } } class ParticleModel { - Animatable tween; - double size; - AnimationProgress animationProgress; + late Animatable tween; + late double size; + late AnimationProgress animationProgress; Random random; ParticleModel(this.random) { @@ -113,13 +119,13 @@ class ParticlePainter extends CustomPainter { void paint(Canvas canvas, Size size) { final paint = Paint()..color = Colors.white.withAlpha(50); - particles.forEach((particle) { + for (var particle in particles) { var progress = particle.animationProgress.progress(time); final animation = particle.tween.transform(progress); final position = Offset(animation["x"] * size.width, animation["y"] * size.height); canvas.drawCircle(position, size.width * 0.2 * particle.size, paint); - }); + } } @override @@ -127,20 +133,24 @@ class ParticlePainter extends CustomPainter { } class AnimatedBackground extends StatelessWidget { + const AnimatedBackground({Key? key}) : super(key: key); + @override Widget build(BuildContext context) { final tween = MultiTrackTween([ - Track("color1").add(Duration(seconds: 3), - ColorTween(begin: Color(0xff8a113a), end: Colors.lightBlue.shade900)), - Track("color2").add(Duration(seconds: 3), - ColorTween(begin: Color(0xff440216), end: Colors.blue.shade600)) + Track("color1").add( + const Duration(seconds: 3), + ColorTween( + begin: const Color(0xff8a113a), end: Colors.lightBlue.shade900)), + Track("color2").add(const Duration(seconds: 3), + ColorTween(begin: const Color(0xff440216), end: Colors.blue.shade600)) ]); return ControlledAnimation( playback: Playback.MIRROR, tween: tween, duration: tween.duration, - builder: (context, animation) { + builder: (context, dynamic animation) { return Container( decoration: BoxDecoration( gradient: LinearGradient( @@ -155,12 +165,12 @@ class AnimatedBackground extends StatelessWidget { class CenteredText extends StatelessWidget { const CenteredText({ - Key key, + Key? key, }) : super(key: key); @override Widget build(BuildContext context) { - return Center( + return const Center( child: Text( "Welcome to Flutter for web", style: TextStyle(color: Colors.white, fontWeight: FontWeight.w200), diff --git a/web/particle_background/lib/simple_animations_package.dart b/web/particle_background/lib/simple_animations_package.dart index 929b366f2..7dc6c8437 100644 --- a/web/particle_background/lib/simple_animations_package.dart +++ b/web/particle_background/lib/simple_animations_package.dart @@ -2,8 +2,9 @@ // https://pub.dev/packages/simple_animations import 'dart:math'; -import 'package:flutter/widgets.dart'; + import 'package:flutter/scheduler.dart'; +import 'package:flutter/widgets.dart'; /// Widget to easily create a continuous animation. /// @@ -22,16 +23,17 @@ import 'package:flutter/scheduler.dart'; /// [startTimeSimulationTicks] property.) class Rendering extends StatefulWidget { final Widget Function(BuildContext context, Duration timeElapsed) builder; - final Function(Duration timeElapsed) onTick; + final Function(Duration timeElapsed)? onTick; final Duration startTime; final int startTimeSimulationTicks; - Rendering( - {this.builder, + const Rendering( + {required this.builder, this.onTick, this.startTime = Duration.zero, - this.startTimeSimulationTicks = 20}) - : assert(builder != null, "Builder needs to defined."); + this.startTimeSimulationTicks = 20, + Key? key}) + : super(key: key); @override _RenderingState createState() => _RenderingState(); @@ -39,8 +41,8 @@ class Rendering extends StatefulWidget { class _RenderingState extends State with SingleTickerProviderStateMixin { - Ticker _ticker; - Duration _timeElapsed = Duration(milliseconds: 0); + late Ticker _ticker; + Duration _timeElapsed = const Duration(milliseconds: 0); @override void initState() { @@ -57,7 +59,7 @@ class _RenderingState extends State void _onRender(Duration effectiveElapsed) { if (widget.onTick != null) { - widget.onTick(effectiveElapsed); + widget.onTick!(effectiveElapsed); } setState(() { _timeElapsed = effectiveElapsed; @@ -66,14 +68,14 @@ class _RenderingState extends State void _simulateStartTimeTicks() { if (widget.onTick != null) { - Iterable.generate(widget.startTimeSimulationTicks + 1).forEach((i) { + for (var i in Iterable.generate(widget.startTimeSimulationTicks + 1)) { final simulatedTime = Duration( milliseconds: (widget.startTime.inMilliseconds * i / widget.startTimeSimulationTicks) .round()); - widget.onTick(simulatedTime); - }); + widget.onTick!(simulatedTime); + } } } @@ -116,29 +118,28 @@ class _RenderingState extends State /// ); /// ``` class MultiTrackTween extends Animatable> { - final _tracksToTween = Map(); + final _tracksToTween = {}; var _maxDuration = 0; MultiTrackTween(List tracks) - : assert(tracks != null && tracks.length > 0, - "Add a List to configure the tween."), - assert(tracks.where((track) => track.items.length == 0).length == 0, + : assert(tracks.isNotEmpty, "Add a List to configure the tween."), + assert(tracks.where((track) => track.items.isEmpty).isEmpty, "Each Track needs at least one added Tween by using the add()-method.") { _computeMaxDuration(tracks); _computeTrackTweens(tracks); } void _computeMaxDuration(List tracks) { - tracks.forEach((track) { + for (var track in tracks) { final trackDuration = track.items .map((item) => item.duration.inMilliseconds) .reduce((sum, item) => sum + item); _maxDuration = max(_maxDuration, trackDuration); - }); + } } void _computeTrackTweens(List tracks) { - tracks.forEach((track) { + for (var track in tracks) { final trackDuration = track.items .map((item) => item.duration.inMilliseconds) .reduce((sum, item) => sum + item); @@ -159,7 +160,7 @@ class MultiTrackTween extends Animatable> { _tracksToTween[track.name] = _TweenData(tween: sequence, maxTime: trackDuration / _maxDuration); - }); + } } /// Returns the highest duration specified by [Track]s. @@ -186,10 +187,10 @@ class MultiTrackTween extends Animatable> { @override Map transform(double t) { - final Map result = Map(); + final Map result = {}; _tracksToTween.forEach((name, tweenData) { - final double tTween = max(0, min(t, tweenData.maxTime - 0.0001)); - result[name] = tweenData.tween.transform(tTween); + final double tTween = max(0, min(t, tweenData.maxTime! - 0.0001)); + result[name] = tweenData.tween!.transform(tTween); }); return result; } @@ -200,7 +201,7 @@ class Track { final String name; final List<_TrackItem> items = []; - Track(this.name) : assert(name != null, "Track name must not be null."); + Track(this.name); /// Adds a "piece of animation" to a [Track]. /// @@ -209,7 +210,7 @@ class Track { /// /// Optionally you can set a named parameter [curve] that applies an easing /// curve to the tween. - Track add(Duration duration, Animatable tween, {Curve curve}) { + Track add(Duration duration, Animatable tween, {Curve? curve}) { items.add(_TrackItem(duration, tween, curve: curve)); return this; } @@ -217,11 +218,9 @@ class Track { class _TrackItem { final Duration duration; - Animatable tween; + late Animatable tween; - _TrackItem(this.duration, Animatable _tween, {Curve curve}) - : assert(duration != null, "Please set a duration."), - assert(_tween != null, "Please set a tween.") { + _TrackItem(this.duration, Animatable _tween, {Curve? curve}) { if (curve != null) { tween = _tween.chain(CurveTween(curve: curve)); } else { @@ -231,8 +230,8 @@ class _TrackItem { } class _TweenData { - final Animatable tween; - final double maxTime; + final Animatable? tween; + final double? maxTime; _TweenData({this.tween, this.maxTime}); } @@ -305,31 +304,27 @@ class ControlledAnimation extends StatefulWidget { final Animatable tween; final Curve curve; final Duration duration; - final Duration delay; - final Widget Function(BuildContext buildContext, T animatedValue) builder; - final Widget Function(BuildContext, Widget child, T animatedValue) + final Duration? delay; + final Widget Function(BuildContext buildContext, T animatedValue)? builder; + final Widget Function(BuildContext, Widget? child, T animatedValue)? builderWithChild; - final Widget child; - final AnimationStatusListener animationControllerStatusListener; + final Widget? child; + final AnimationStatusListener? animationControllerStatusListener; final double startPosition; - ControlledAnimation( + const ControlledAnimation( {this.playback = Playback.PLAY_FORWARD, - this.tween, + required this.tween, this.curve = Curves.linear, - this.duration, + required this.duration, this.delay, this.builder, this.builderWithChild, this.child, this.animationControllerStatusListener, this.startPosition = 0.0, - Key key}) - : assert(duration != null, - "Please set property duration. Example: Duration(milliseconds: 500)"), - assert(tween != null, - "Please set property tween. Example: Tween(from: 0.0, to: 100.0)"), - assert( + Key? key}) + : assert( (builderWithChild != null && child != null && builder == null) || (builder != null && builderWithChild == null && child == null), "Either use just builder and keep buildWithChild and child null. " @@ -346,8 +341,8 @@ class ControlledAnimation extends StatefulWidget { class _ControlledAnimationState extends State with SingleTickerProviderStateMixin { - AnimationController _controller; - Animation _animation; + late AnimationController _controller; + late Animation _animation; bool _isDisposed = false; bool _waitForDelay = true; bool _isCurrentlyMirroring = false; @@ -362,19 +357,19 @@ class _ControlledAnimationState extends State _animation = widget.tween .chain(CurveTween(curve: widget.curve)) - .animate(_controller); + .animate(_controller) as Animation; if (widget.animationControllerStatusListener != null) { - _controller.addStatusListener(widget.animationControllerStatusListener); + _controller.addStatusListener(widget.animationControllerStatusListener!); } initialize(); super.initState(); } - void initialize() async { + Future initialize() async { if (widget.delay != null) { - await Future.delayed(widget.delay); + await Future.delayed(widget.delay!); } _waitForDelay = false; executeInstruction(); @@ -387,7 +382,7 @@ class _ControlledAnimationState extends State super.didUpdateWidget(oldWidget); } - void executeInstruction() async { + Future executeInstruction() async { if (_isDisposed || _waitForDelay) { return; } @@ -423,9 +418,9 @@ class _ControlledAnimationState extends State @override Widget build(BuildContext context) { if (widget.builder != null) { - return widget.builder(context, _animation.value); + return widget.builder!(context, _animation.value); } else if (widget.builderWithChild != null && widget.child != null) { - return widget.builderWithChild(context, widget.child, _animation.value); + return widget.builderWithChild!(context, widget.child, _animation.value); } _controller.stop(canceled: true); throw FlutterError( @@ -452,10 +447,7 @@ class AnimationProgress { final Duration startTime; /// Creates an [AnimationProgress]. - AnimationProgress({this.duration, this.startTime}) - : assert(duration != null, "Please specify an animation duration."), - assert( - startTime != null, "Please specify a start time of the animation."); + AnimationProgress({required this.duration, required this.startTime}); /// Queries the current progress value based on the specified [startTime] and /// [duration] as a value between `0.0` and `1.0`. It will automatically diff --git a/web/particle_background/pubspec.lock b/web/particle_background/pubspec.lock index 6b0904fa2..c5ec63469 100644 --- a/web/particle_background/pubspec.lock +++ b/web/particle_background/pubspec.lock @@ -20,6 +20,20 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_lints: + dependency: "direct main" + description: + name: flutter_lints + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" + lints: + dependency: transitive + description: + name: lints + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" meta: dependency: transitive description: diff --git a/web/particle_background/pubspec.yaml b/web/particle_background/pubspec.yaml index 75460d64f..d90c1f5ae 100644 --- a/web/particle_background/pubspec.yaml +++ b/web/particle_background/pubspec.yaml @@ -3,11 +3,12 @@ description: Example for the simple_animations package homepage: https://github.com/felixblaschke/simple_animations environment: - sdk: ">=2.2.0 <3.0.0" + sdk: '>=2.12.0 <3.0.0' dependencies: flutter: sdk: flutter + flutter_lints: ^1.0.4 flutter: assets: - preview.png