Skip to content

Commit

Permalink
[Sender]: Fix dart client null safety (#96)
Browse files Browse the repository at this point in the history
* fix: null safety
  • Loading branch information
santitigaga authored Jan 14, 2025
1 parent cebd61e commit b72ca09
Show file tree
Hide file tree
Showing 18 changed files with 497 additions and 230 deletions.
4 changes: 3 additions & 1 deletion clients/client-dart/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# CHANGELOG

## [2.0.1]
- Null safety
- Refactor
## [2.0.0] - Add Channel Message to `subscribeTo`
## [1.0.2] - Add Dart Code Linter
## [1.0.1] - Update of dependencies to comply with null safety definition
Expand Down
152 changes: 148 additions & 4 deletions clients/client-dart/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,64 @@
include: package:flutter_lints/flutter.yaml

linter:
rules:
avoid_print: true
avoid_unnecessary_containers: true
avoid_web_libraries_in_flutter: true
no_logic_in_create_state: false
prefer_const_constructors: true
prefer_const_constructors_in_immutables: true
prefer_const_declarations: true
prefer_const_literals_to_create_immutables: true
sized_box_for_whitespace: true
use_full_hex_values_for_flutter_colors: true
always_declare_return_types: true
cancel_subscriptions: true
close_sinks: true
comment_references: false
one_member_abstracts: false
only_throw_errors: true
package_api_docs: true
prefer_single_quotes: true
sort_child_properties_last: true
camel_case_types: true
library_names: true
avoid_relative_lib_imports: false
file_names: true
library_prefixes: true
non_constant_identifier_names: true
constant_identifier_names: false
directives_ordering: true
curly_braces_in_flow_control_structures: true
slash_for_doc_comments: false
prefer_interpolation_to_compose_strings: true
prefer_collection_literals: true
avoid_function_literals_in_foreach_calls: false
avoid_init_to_null: true
prefer_initializing_formals: true
type_init_formals: true
empty_constructor_bodies: true
empty_statements: true
unnecessary_new: true
unnecessary_this: true
unnecessary_const: true
unnecessary_overrides: true
unnecessary_parenthesis: true
unnecessary_getters_setters: true
avoid_setters_without_getters: true
avoid_return_types_on_setters: true
parameter_assignments: true
prefer_function_declarations_over_variables: false
unawaited_futures: true
prefer_relative_imports: true
annotate_overrides: false
overridden_fields: false
implementation_imports: false
no_leading_underscores_for_local_identifiers: true
depend_on_referenced_packages: false
use_super_parameters: true
use_build_context_synchronously: true

analyzer:
errors:
missing_required_param: error
Expand All @@ -7,11 +67,95 @@ analyzer:
use_setters_to_change_properties: ignore
deprecated_member_use: warning
deprecated_member_use_from_same_package: warning
no_leading_underscores_for_local_identifiers: warning
use_super_parameters: warning
use_build_context_synchronously: warning
todo: warning
exclude:
- "**.mocks.dart"
- "**.g.dart"
plugins:
- dart_code_linter

dart_code_linter:
extends:
- package:dart_code_linter/presets/recommended.yaml

metrics:
cyclomatic-complexity: 20
maximum-nesting-level: 5
number-of-methods: 10
number-of-parameters: 4
source-lines-of-code: 250
metrics-exclude:
- test/**
rules:
- avoid-non-null-assertion
- avoid-dynamic
- avoid-returning-widgets
- avoid-nested-conditional-expressions
- avoid-unnecessary-type-casts
- avoid-unnecessary-conditionals
- avoid-unused-parameters:
severity: none
- missing-test-assertion
- newline-before-return:
severity: none
- no-boolean-literal-compare
- no-empty-block
- no-equal-then-else
- no-magic-number
- prefer-trailing-comma:
severity: none
- prefer-conditional-expressions
- prefer-immediate-return
- prefer-moving-to-variable
- format-comment:
only-doc-comments: true
- member-ordering:
order:
- public-fields
- private-fields
- constructors
- close-method
- dispose-method
widgets-order:
- constructor
- build-method
- init-state-method
- did-change-dependencies-method
- did-update-widget-method
- dispose-method

- always-remove-listener
- avoid-unnecessary-setstate
- prefer-extracting-callbacks
- prefer-using-list-view
- avoid-ignoring-return-values:
severity: none
- avoid-passing-async-when-sync-expected:
exclude:
- test/**
- avoid-unnecessary-type-assertions
- avoid-unrelated-type-assertions
- double-literal-format
- prefer-async-await
- prefer-correct-identifier-length:
max-identifier-length: 35
min-identifier-length: 2
- prefer-correct-test-file-name
- prefer-correct-type-name:
min-length: 3
max-length: 35
- prefer-first
- prefer-last
- prefer-match-file-name:
exclude:
- test/**
- avoid-border-all
- avoid-expanded-as-spacer
- avoid-wrapping-in-padding
- no-blank-line-before-single-return
- prefer-first-or-null
- prefer-single-quotes

anti-patterns:
- long-method
- long-parameter-list
Loading

0 comments on commit b72ca09

Please sign in to comment.