Skip to content

Commit

Permalink
Fix lints for Dart 3.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ThexXTURBOXx committed Feb 17, 2024
1 parent 9710fc8 commit 30d78d5
Show file tree
Hide file tree
Showing 11 changed files with 191 additions and 96 deletions.
46 changes: 36 additions & 10 deletions flutter_web_auth_2/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@ linter:
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
- always_declare_return_types
- always_put_control_body_on_new_line
# - always_put_required_named_parameters_first
- always_put_required_named_parameters_first
# - always_specify_types
- always_use_package_imports
- annotate_overrides
# - avoid_annotating_with_dynamic
- annotate_redeclares
- avoid_annotating_with_dynamic
- avoid_bool_literals_in_conditional_expressions
# - avoid_catches_without_on_clauses
- avoid_catching_errors
Expand All @@ -61,8 +60,9 @@ linter:
- avoid_equals_and_hash_code_on_mutable_classes
- avoid_escaping_inner_quotes
- avoid_field_initializers_in_const_classes
- avoid_final_parameters
- avoid_function_literals_in_foreach_calls
# - avoid_implementing_value_types
- avoid_implementing_value_types
- avoid_init_to_null
- avoid_js_rounded_ints
- avoid_multiple_declarations_per_line
Expand Down Expand Up @@ -91,18 +91,23 @@ linter:
- camel_case_extensions
- camel_case_types
- cancel_subscriptions
# - cascade_invocations
- cascade_invocations
- cast_nullable_to_non_nullable
- close_sinks
- collection_methods_unrelated_type
- combinators_ordering
- comment_references
- conditional_uri_does_not_exist
- constant_identifier_names
- control_flow_in_finally
- curly_braces_in_flow_control_structures
- dangling_library_doc_comments
- depend_on_referenced_packages
- deprecated_consistency
# - diagnostic_describe_all_properties
- deprecated_member_use_from_same_package
- diagnostic_describe_all_properties
- directives_ordering
- discarded_futures
- do_not_use_environment
- empty_catches
- empty_constructor_bodies
Expand All @@ -113,21 +118,29 @@ linter:
- flutter_style_todos
- hash_and_equals
- implementation_imports
- implicit_call_tearoffs
- implicit_reopen
- invalid_case_patterns
- join_return_with_assignment
- leading_newlines_in_multiline_strings
- library_annotations
- library_names
- library_prefixes
- library_private_types_in_public_api
- lines_longer_than_80_chars
- literal_only_boolean_expressions
- matching_super_parameters
- missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list
# - no_default_cases
- no_default_cases
- no_duplicate_case_values
- no_leading_underscores_for_library_prefixes
- no_leading_underscores_for_local_identifiers
- no_literal_bool_comparisons
- no_logic_in_create_state
- no_runtimeType_toString
- no_self_assignments
- no_wildcard_variable_uses
- non_constant_identifier_names
- noop_primitive_operations
- null_check_on_nullable_type_parameter
Expand Down Expand Up @@ -180,31 +193,37 @@ linter:
- prefer_typing_uninitialized_variables
- prefer_void_to_null
- provide_deprecation_message
# - public_member_api_docs
- public_member_api_docs
- recursive_getters
- require_trailing_commas
- secure_pubspec_urls
- sized_box_for_whitespace
- sized_box_shrink_expand
- slash_for_doc_comments
- sort_child_properties_last
# - sort_constructors_first
- sort_constructors_first
- sort_pub_dependencies
- sort_unnamed_constructors_first
- test_types_in_equals
- throw_in_finally
- tighten_type_of_initializing_formals
- type_annotate_public_apis
- type_init_formals
- type_literal_in_constant_pattern
- unawaited_futures
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_breaks
- unnecessary_const
- unnecessary_constructor_name
# - unnecessary_final
- unnecessary_getters_setters
- unnecessary_lambdas
- unnecessary_late
- unnecessary_library_directive
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_aware_operator_on_extension_on_nullable
- unnecessary_null_checks
- unnecessary_null_in_if_null_operators
- unnecessary_nullable_for_final_variable_declarations
Expand All @@ -215,9 +234,14 @@ linter:
- unnecessary_string_escapes
- unnecessary_string_interpolations
- unnecessary_this
- unnecessary_to_list_in_spreads
- unreachable_from_main
- unrelated_type_equality_checks
- unsafe_html
- use_build_context_synchronously
- use_colored_box
- use_decorated_box
- use_enums
- use_full_hex_values_for_flutter_colors
- use_function_type_syntax_for_parameters
- use_if_null_to_convert_nulls_to_bools
Expand All @@ -229,6 +253,8 @@ linter:
- use_rethrow_when_possible
- use_setters_to_change_properties
- use_string_buffers
- use_string_in_part_of_directives
- use_super_parameters
- use_test_throws_matchers
- use_to_and_as_if_applicable
- valid_regexps
Expand Down
46 changes: 36 additions & 10 deletions flutter_web_auth_2/example/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@ linter:
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
- always_declare_return_types
- always_put_control_body_on_new_line
# - always_put_required_named_parameters_first
- always_put_required_named_parameters_first
# - always_specify_types
- always_use_package_imports
- annotate_overrides
# - avoid_annotating_with_dynamic
- annotate_redeclares
- avoid_annotating_with_dynamic
- avoid_bool_literals_in_conditional_expressions
# - avoid_catches_without_on_clauses
- avoid_catching_errors
Expand All @@ -61,8 +60,9 @@ linter:
- avoid_equals_and_hash_code_on_mutable_classes
- avoid_escaping_inner_quotes
- avoid_field_initializers_in_const_classes
- avoid_final_parameters
- avoid_function_literals_in_foreach_calls
# - avoid_implementing_value_types
- avoid_implementing_value_types
- avoid_init_to_null
- avoid_js_rounded_ints
- avoid_multiple_declarations_per_line
Expand Down Expand Up @@ -91,18 +91,23 @@ linter:
- camel_case_extensions
- camel_case_types
- cancel_subscriptions
# - cascade_invocations
- cascade_invocations
- cast_nullable_to_non_nullable
- close_sinks
- collection_methods_unrelated_type
- combinators_ordering
- comment_references
- conditional_uri_does_not_exist
- constant_identifier_names
- control_flow_in_finally
- curly_braces_in_flow_control_structures
- dangling_library_doc_comments
- depend_on_referenced_packages
- deprecated_consistency
# - diagnostic_describe_all_properties
- deprecated_member_use_from_same_package
- diagnostic_describe_all_properties
- directives_ordering
- discarded_futures
- do_not_use_environment
- empty_catches
- empty_constructor_bodies
Expand All @@ -113,21 +118,29 @@ linter:
- flutter_style_todos
- hash_and_equals
- implementation_imports
- implicit_call_tearoffs
- implicit_reopen
- invalid_case_patterns
- join_return_with_assignment
- leading_newlines_in_multiline_strings
- library_annotations
- library_names
- library_prefixes
- library_private_types_in_public_api
- lines_longer_than_80_chars
- literal_only_boolean_expressions
- matching_super_parameters
- missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list
# - no_default_cases
- no_default_cases
- no_duplicate_case_values
- no_leading_underscores_for_library_prefixes
- no_leading_underscores_for_local_identifiers
- no_literal_bool_comparisons
- no_logic_in_create_state
- no_runtimeType_toString
- no_self_assignments
- no_wildcard_variable_uses
- non_constant_identifier_names
- noop_primitive_operations
- null_check_on_nullable_type_parameter
Expand All @@ -136,7 +149,7 @@ linter:
- one_member_abstracts
- only_throw_errors
- overridden_fields
- package_api_docs
# - package_api_docs
- package_names
- package_prefixed_library_names
- parameter_assignments
Expand Down Expand Up @@ -183,28 +196,34 @@ linter:
# - public_member_api_docs
- recursive_getters
- require_trailing_commas
- secure_pubspec_urls
- sized_box_for_whitespace
- sized_box_shrink_expand
- slash_for_doc_comments
- sort_child_properties_last
# - sort_constructors_first
- sort_constructors_first
- sort_pub_dependencies
- sort_unnamed_constructors_first
- test_types_in_equals
- throw_in_finally
- tighten_type_of_initializing_formals
- type_annotate_public_apis
- type_init_formals
- type_literal_in_constant_pattern
- unawaited_futures
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_breaks
- unnecessary_const
- unnecessary_constructor_name
# - unnecessary_final
- unnecessary_getters_setters
- unnecessary_lambdas
- unnecessary_late
- unnecessary_library_directive
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_aware_operator_on_extension_on_nullable
- unnecessary_null_checks
- unnecessary_null_in_if_null_operators
- unnecessary_nullable_for_final_variable_declarations
Expand All @@ -215,9 +234,14 @@ linter:
- unnecessary_string_escapes
- unnecessary_string_interpolations
- unnecessary_this
- unnecessary_to_list_in_spreads
- unreachable_from_main
- unrelated_type_equality_checks
- unsafe_html
- use_build_context_synchronously
- use_colored_box
- use_decorated_box
- use_enums
- use_full_hex_values_for_flutter_colors
- use_function_type_syntax_for_parameters
- use_if_null_to_convert_nulls_to_bools
Expand All @@ -229,6 +253,8 @@ linter:
- use_rethrow_when_possible
- use_setters_to_change_properties
- use_string_buffers
- use_string_in_part_of_directives
- use_super_parameters
- use_test_throws_matchers
- use_to_and_as_if_applicable
- valid_regexps
Expand Down
8 changes: 4 additions & 4 deletions flutter_web_auth_2/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_web_auth_2/flutter_web_auth_2.dart';

const html = '''
const _html = '''
<!DOCTYPE html>
<html>
<head>
Expand Down Expand Up @@ -82,10 +82,10 @@ class MyAppState extends State<MyApp> {
String _status = '';

@override
void initState() {
Future<void> initState() async {
super.initState();
if (!kIsWeb) {
startServer();
await startServer();
}
}

Expand All @@ -100,7 +100,7 @@ class MyAppState extends State<MyApp> {
req.response.headers.add('Content-Type', 'text/html');

req.response.write(
html.replaceFirst(
_html.replaceFirst(
'CALLBACK_URL_HERE',
'foobar://success?code=1337',
),
Expand Down
11 changes: 6 additions & 5 deletions flutter_web_auth_2/lib/flutter_web_auth_2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@ export 'src/unsupported.dart'
if (dart.library.html) 'src/web.dart';

class _OnAppLifecycleResumeObserver extends WidgetsBindingObserver {
final Function onResumed;

_OnAppLifecycleResumeObserver(this.onResumed);

final Future<void> Function() onResumed;

@override
void didChangeAppLifecycleState(AppLifecycleState state) {
Future<void> didChangeAppLifecycleState(AppLifecycleState state) async {
if (state == AppLifecycleState.resumed) {
onResumed();
await onResumed();
}
}
}

/// Provides all the functions you - as a user - should access
class FlutterWebAuth2 {
static final RegExp _schemeRegExp = RegExp(r'^[a-z][a-z\d+.-]*$');

Expand Down Expand Up @@ -80,7 +81,7 @@ class FlutterWebAuth2 {
);
}

/// The plugin has to store the Result callbacks in order to pass
/// The plugin may need to store the resulting callbacks in order to pass
/// the result back to the caller of `authenticate`. But if that result never
/// comes the callback will dangle around forever. This can be called to
/// terminate all `authenticate` calls with an error.
Expand Down
Loading

0 comments on commit 30d78d5

Please sign in to comment.