Skip to content

Commit

Permalink
Update analysis options and localization.dart files, refactor Control…
Browse files Browse the repository at this point in the history
…ler class, and fix linting issues in various files
  • Loading branch information
PlugFox committed May 2, 2024
1 parent 4cd67aa commit 0cd3e39
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 9 deletions.
3 changes: 0 additions & 3 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ linter:
avoid_js_rounded_ints: true
avoid_print: true
avoid_renaming_method_parameters: true
avoid_returning_null_for_future: true
avoid_returning_null_for_void: true
avoid_single_cascade_in_expression_statements: true
avoid_slow_async_io: true
Expand Down Expand Up @@ -140,7 +139,6 @@ linter:

# Pedantic 1.9.0
always_declare_return_types: true
always_require_non_null_named_parameters: true
annotate_overrides: true
avoid_empty_else: true
avoid_init_to_null: true
Expand Down Expand Up @@ -204,7 +202,6 @@ linter:
prefer_mixin: true
use_setters_to_change_properties: true
avoid_setters_without_getters: true
avoid_returning_null: true
avoid_returning_this: true
type_annotate_public_apis: true
avoid_types_on_closure_parameters: true
Expand Down
7 changes: 5 additions & 2 deletions example/lib/src/common/controller/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ abstract interface class IControllerObserver {
void onDispose(IController controller);

/// Called on any state change in the controller.
void onStateChanged(IController controller, Object prevState, Object nextState);
void onStateChanged(
IController controller, Object prevState, Object nextState);

/// Called on any error in the controller.
void onError(IController controller, Object error, StackTrace stackTrace);
}

/// {@template controller}
/// {@macro controller}
abstract base class Controller with ChangeNotifier implements IController {
/// {@macro controller}
Controller() {
runZonedGuarded<void>(
() => Controller.observer?.onCreate(this),
Expand All @@ -44,6 +46,7 @@ abstract base class Controller with ChangeNotifier implements IController {
/// Controller observer
static IControllerObserver? observer;

/// Whether the controller is disposed.
bool get isDisposed => _$isDisposed;
bool _$isDisposed = false;

Expand Down
2 changes: 1 addition & 1 deletion example/lib/src/common/localization/localization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class Localization extends generated.GeneratedLocalization {
/// Get language by code.
static ({String name, String nativeName})? getLanguageByCode(String code) =>
switch (_isoLangs[code]) {
(:String name, :String nativeName) => (
(String name, String nativeName) => (
name: name,
nativeName: nativeName
),
Expand Down
2 changes: 1 addition & 1 deletion example/lib/src/common/widget/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class App extends StatelessWidget {
builder: (context, child) => MediaQuery(
data: MediaQuery.of(context).copyWith(
/* textScaler: TextScaler.noScaling, */
textScaleFactor: 1,
textScaler: const TextScaler.linear(1),
),
child: WindowScope(
/* title: Localization.of(context).title, */
Expand Down
2 changes: 1 addition & 1 deletion lib/src/model/channel_push.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:spinify/src/model/event.dart';
/// {@subCategory Push}
@immutable
abstract base class SpinifyChannelPush extends SpinifyEvent {
/// {@template spinify_channel_push}
/// {@macro spinify_channel_push}
const SpinifyChannelPush({
required super.timestamp,
required this.channel,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/model/event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:meta/meta.dart';
/// {@category Event}
@immutable
abstract base class SpinifyEvent implements Comparable<SpinifyEvent> {
/// {@template spinify_event}
/// {@macro spinify_event}
const SpinifyEvent({
required this.timestamp,
});
Expand Down
3 changes: 3 additions & 0 deletions lib/src/subscription/subscription_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ sealed class SpinifySubscriptionState extends _$SpinifySubscriptionStateBase {
/// {@category Entity}
final class SpinifySubscriptionState$Unsubscribed
extends SpinifySubscriptionState {
/// {@macro subscription_state}
SpinifySubscriptionState$Unsubscribed({
required this.code,
required this.reason,
Expand Down Expand Up @@ -119,6 +120,7 @@ final class SpinifySubscriptionState$Unsubscribed
/// {@category Entity}
final class SpinifySubscriptionState$Subscribing
extends SpinifySubscriptionState {
/// {@macro subscription_state}
SpinifySubscriptionState$Subscribing({
DateTime? timestamp,
super.since,
Expand Down Expand Up @@ -168,6 +170,7 @@ final class SpinifySubscriptionState$Subscribing
/// {@category Entity}
final class SpinifySubscriptionState$Subscribed
extends SpinifySubscriptionState {
/// {@macro subscription_state}
SpinifySubscriptionState$Subscribed({
DateTime? timestamp,
super.since,
Expand Down
2 changes: 2 additions & 0 deletions lib/src/transport/ws_protobuf_transport.dart
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,7 @@ base mixin SpinifyWSPBPingPongMixin on SpinifyWSPBTransportBase {
final List<SpinifyPublication> _emptyPublicationsList =
List<SpinifyPublication>.empty(growable: false);

/// Decode protobuf messages to Spinify models.
@internal
SpinifyPublication Function(pb.Publication publication) $publicationDecode(
String channel,
Expand All @@ -995,6 +996,7 @@ SpinifyPublication Function(pb.Publication publication) $publicationDecode(
);
}

/// Decode protobuf client info to Spinify client info.
@internal
SpinifyClientInfo $decodeClientInfo(pb.ClientInfo info) => SpinifyClientInfo(
client: info.client,
Expand Down

0 comments on commit 0cd3e39

Please sign in to comment.