Skip to content

Commit

Permalink
Dart 3.4 requirement and linter fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
renggli committed May 25, 2024
1 parent 5cb2687 commit e532242
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 26 deletions.
2 changes: 2 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ linter:
- comment_references
- directives_ordering
- invalid_case_patterns
- missing_code_block_language_in_doc_comment
- no_self_assignments
- no_wildcard_variable_uses
- omit_local_variable_types
Expand All @@ -33,6 +34,7 @@ linter:
- unnecessary_await_in_return
- unnecessary_breaks
- unnecessary_lambdas
- unnecessary_library_name
- unnecessary_null_aware_operator_on_extension_on_nullable
- unnecessary_null_checks
- unnecessary_parenthesis
Expand Down
13 changes: 7 additions & 6 deletions lib/src/constructors/create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ import '../disposables/disposable.dart';
///
/// For example:
///
/// final observable = create<String>((subscriber) {
/// subscriber.next('a');
/// /* ... */
/// subscriber.add(ActionDisposable(() => /* free expensive resource */));
/// });
///
/// ```dart
/// final observable = create<String>((subscriber) {
/// subscriber.next('a');
/// /* ... */
/// subscriber.add(ActionDisposable(() => /* free expensive resource */));
/// });
/// ```
Observable<T> create<T>(Callback1<Subscriber<T>> callback) =>
CreateObservable<T>(callback);

Expand Down
37 changes: 19 additions & 18 deletions lib/src/store/store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,25 @@ import 'types.dart';
///
/// The canonical example with the counter looks like this:
///
/// // Create a store with the initial value 0.
/// final store = Store<int>(0);
///
/// // Subscribe to state changes and print the new state to the console.
/// store.subscribe(Observer.next((state) => print(state)));
///
/// // Increment the value by one. In a more complicated example one
/// // could extract the function to be standalone, or generalize it to
/// // handle different actions.
/// store.update((state) => state + 1);
///
/// // Alternatively, one can subscribe to an observable and provide
/// // reducer functions for its events to update the state asynchronously.
/// // The following lines set the state to a random value every 10 seconds.
/// final randomValue = timer(period: Duration(seconds: 10))
/// .map((_) => Random().nextInt(100));
/// store.addObservable(randomValue, next: (state, value) => value);
///
/// ```dart
/// // Create a store with the initial value 0.
/// final store = Store<int>(0);
///
/// // Subscribe to state changes and print the new state to the console.
/// store.subscribe(Observer.next((state) => print(state)));
///
/// // Increment the value by one. In a more complicated example one
/// // could extract the function to be standalone, or generalize it to
/// // handle different actions.
/// store.update((state) => state + 1);
///
/// // Alternatively, one can subscribe to an observable and provide
/// // reducer functions for its events to update the state asynchronously.
/// // The following lines set the state to a random value every 10 seconds.
/// final randomValue = timer(period: Duration(seconds: 10))
/// .map((_) => Random().nextInt(100));
/// store.addObservable(randomValue, next: (state, value) => value);
/// ```
abstract class Store<S> implements Observable<S> {
/// Constructs a standard store from an initial state.
factory Store(S initialState) {
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ topics:
- streams

environment:
sdk: ^3.3.0
sdk: ^3.4.0
dependencies:
collection: ^1.18.0
matcher: ^0.12.0
meta: ^1.11.0
more: ^4.2.0
dev_dependencies:
lints: ^3.0.0
lints: ^4.0.0
test: ^1.24.0

0 comments on commit e532242

Please sign in to comment.