• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Duit-Foundation / duit_kernel / 20682128358

03 Jan 2026 07:51PM UTC coverage: 76.339% (-0.3%) from 76.636%
20682128358

Pull #51

github

web-flow
Merge 424eecc27 into 9c331752d
Pull Request #51: feat: Add ViewModel capability

0 of 9 new or added lines in 1 file covered. (0.0%)

37 existing lines in 2 files now uncovered.

1768 of 2316 relevant lines covered (76.34%)

4.85 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/lib/src/action_api/action_executor.dart
1
import "package:duit_kernel/duit_kernel.dart";
2

3
/// The [ActionExecutor] is an abstract class responsible for executing actions.
4
///
5
/// It relies on a [UIDriver] to perform actions and an [DebugLogger] to log messages.
6
/// This class serves as a base for concrete implementations that define how actions
7
/// should be executed.
8
///
9
/// Subclasses must implement the [executeAction] method to handle different types
10
/// of [ServerAction]s.
11
@Deprecated("Will be removed in the next major release.")
12
abstract class ActionExecutor {
13
  final UIDriver driver;
14
  final DebugLogger? logger;
15

UNCOV
16
  ActionExecutor({
×
17
    required this.driver,
18
    this.logger,
19
  });
20

21
  Future<ServerEvent?> executeAction(
22
    ServerAction action,
23
  );
24
}
25

26
/// Executes a given [ServerAction].
27
///
28
/// The [executeAction] method takes a [ServerAction] as a parameter and
29
/// performs the necessary operations to execute it. This is an abstract
30
/// method that must be implemented by subclasses. It relies on the [UIDriver]
31
/// to resolve the event associated with the action and perform the execution.
32
///
33
/// Implementations should handle different types of actions, such as
34
/// [TransportAction], by using switch cases or other control flow mechanisms.
35
///
36
/// This method is asynchronous and returns a [Future] that completes when
37
/// the action execution is finished.
38
@Deprecated("Will be removed in the next major release.")
39
final class DefaultActionExecutor extends ActionExecutor {
UNCOV
40
  DefaultActionExecutor({
×
41
    required super.driver,
42
    super.logger,
43
  });
44

UNCOV
45
  @override
×
46
  Future<ServerEvent?> executeAction(
47
    ServerAction action,
48
  ) async {
49
    switch (action) {
50
      //transport
51
      case TransportAction():
×
52
        try {
53
          final payload = driver.preparePayload(action.dependsOn);
×
54

UNCOV
55
          final res = await driver.transport?.execute(action, payload);
×
56

57
          if (res != null) {
UNCOV
58
            return ServerEvent.parseEvent(res);
×
59
          }
60

61
          return null;
62
        } catch (e, s) {
UNCOV
63
          logger?.error(
×
64
            "[Error while executing transport action]",
65
            error: e,
66
            stackTrace: s,
67
          );
68
        }
69

70
        break;
71
      //local execution
72
      case LocalAction():
×
73
        try {
74
          return action.event;
×
75
        } catch (e, s) {
UNCOV
76
          logger?.error(
×
77
            "[Error while executing local action]",
78
            error: e,
79
            stackTrace: s,
80
          );
81
        }
82
        break;
83
      //script
84
      case ScriptAction():
×
85
        try {
UNCOV
86
          final body = driver.preparePayload(action.dependsOn);
×
87
          final script = action.script;
×
88

89
          final scriptInvocationResult = await driver.scriptRunner?.runScript(
×
90
            script.functionName,
×
UNCOV
91
            url: action.eventName,
×
UNCOV
92
            meta: action.script.meta,
×
93
            body: body,
94
          );
95

96
          if (scriptInvocationResult != null) {
UNCOV
97
            return ServerEvent.parseEvent(scriptInvocationResult);
×
98
          }
99

100
          return null;
101
        } catch (e, s) {
UNCOV
102
          logger?.error(
×
103
            "[Error while executing script action]",
104
            error: e,
105
            stackTrace: s,
106
          );
107
        }
108
        break;
109
    }
110

111
    return null;
112
  }
113
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc