Skip to content

Commit 7b2ae4c

Browse files
authored
patch: Code cleanup (#29)
* Removed late final modificators for parsers, added const constructors * Run dart format
1 parent 2d01f0b commit 7b2ae4c

File tree

14 files changed

+14
-10
lines changed

14 files changed

+14
-10
lines changed

lib/src/action_api/action.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'package:duit_kernel/duit_kernel.dart';
22

33
/// The [ServerAction] class represents an action that was sent by the server.
44
base class ServerAction {
5-
static late final Parser<ServerAction> _actionParser;
5+
static late Parser<ServerAction> _actionParser;
66

77
/// Set the parser to use for [ServerAction]s.
88
///

lib/src/action_api/action_parser.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import 'package:duit_kernel/duit_kernel.dart';
55
/// It uses a [ServerActionJsonView] to parse the JSON map into a concrete action
66
/// object based on the [ExecutionType] of the action.
77
final class DefaultActionParser implements Parser<ServerAction> {
8+
const DefaultActionParser();
9+
810
@override
911
ServerAction parse(Map<String, dynamic> json) {
1012
final view = ServerActionJsonView(json);

lib/src/action_api/event.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import 'package:duit_kernel/duit_kernel.dart';
77
/// The [ServerEvent] class provides a static [parse] method for parsing a JSON map
88
/// into a concrete event object.
99
base class ServerEvent {
10-
static late final Parser<ServerEvent> _eventParser;
10+
static late Parser<ServerEvent> _eventParser;
1111

1212
static set eventParser(Parser<ServerEvent> value) {
1313
_eventParser = value;

lib/src/action_api/event_parser.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import 'package:duit_kernel/duit_kernel.dart';
88
/// The [DefaultEventParser] is used by the [DefaultEventResolver] to parse events
99
/// from the server.
1010
final class DefaultEventParser implements Parser<ServerEvent> {
11+
const DefaultEventParser();
12+
1113
@override
1214
ServerEvent parse(Map<String, dynamic> json) {
1315
final type = json["type"];

lib/src/animation_api/index.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ export 'animated_prop_owner.dart';
22
export 'method.dart';
33
export 'interval.dart';
44
export 'trigger.dart';
5-
export 'command.dart';
5+
export 'command.dart';

lib/src/animation_api/interval.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/// An [AnimationInterval] represents a time interval
32
/// for an animation.
43
final class AnimationInterval {

lib/src/animation_api/method.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ enum AnimationMethod {
44
forward,
55
repeat,
66
reverse,
7+
78
/// Toggle between forward and reverse
89
toggle,
910
}

lib/src/animation_api/trigger.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
enum AnimationTrigger {
33
/// Triggers when the animation enters the screen.
44
onEnter,
5+
56
/// Triggers when the action is triggered.
67
onAction,
78
}

lib/src/driver_api/dependency.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ final class ActionDependency {
2020
id: json["id"],
2121
);
2222
}
23-
}
23+
}

lib/src/driver_api/script_def.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/// The [ScriptDefinition] class represents a script definition used for script actions.
32
///
43
/// It contains the following fields:

0 commit comments

Comments
 (0)