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

Duit-Foundation / flutter_duit / 21026233449

15 Jan 2026 09:26AM UTC coverage: 80.184% (-8.3%) from 88.441%
21026233449

push

github

web-flow
feat: Capability-based API migration pt2 (#323)

162 of 408 new or added lines in 23 files covered. (39.71%)

328 existing lines in 17 files now uncovered.

4354 of 5430 relevant lines covered (80.18%)

34.33 hits per line

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

82.86
/lib/src/capabilities/focus_capability_impl.dart
1
import "package:duit_kernel/duit_kernel.dart";
2
import "package:flutter/widgets.dart";
3
import "package:flutter_duit/flutter_duit.dart";
4

5
final class DuitFocusNodeManager with FocusCapabilityDelegate {
6
  final _nodeRegistry = <String, FocusNode>{};
7
  late final UIDriver _driver;
8

9
  @override
44✔
10
  void attachFocusNode(String nodeId, FocusNode node) {
11
    final existing = _nodeRegistry[nodeId];
88✔
12
    if (existing != null) {
NEW
13
      existing.dispose();
×
NEW
14
      _driver.logWarning(
×
NEW
15
        "Focus node with id=$nodeId already exists and it will be overriden \n This could happen because two or more controlled widgets have the same id parameter",
×
16
      );
17
    }
18
    _nodeRegistry[nodeId] = node;
88✔
19
  }
20

21
  @override
44✔
22
  void detachFocusNode(String nodeId) =>
23
      _nodeRegistry.remove(nodeId)?.dispose();
132✔
24

25
  @override
4✔
26
  bool focusInDirection(String nodeId, TraversalDirection direction) =>
27
      _nodeRegistry[nodeId]?.focusInDirection(direction) ??
12✔
28
      (throw MissingFocusNodeException(
4✔
29
        nodeId,
30
        "focusInDirection",
31
      ));
32

33
  @override
4✔
34
  bool nextFocus(String nodeId) =>
35
      _nodeRegistry[nodeId]?.nextFocus() ??
12✔
36
      (throw MissingFocusNodeException(
4✔
37
        nodeId,
38
        "nextFocus",
39
      ));
40

41
  @override
4✔
42
  bool previousFocus(String nodeId) =>
43
      _nodeRegistry[nodeId]?.previousFocus() ??
12✔
44
      (throw MissingFocusNodeException(
4✔
45
        nodeId,
46
        "previousFocus",
47
      ));
48

49
  @override
4✔
50
  void requestFocus(String nodeId, {String? targetNodeId}) {
51
    final node = _nodeRegistry[nodeId];
8✔
52
    if (node != null) {
53
      if (targetNodeId != null) {
54
        final targetNode = _nodeRegistry[targetNodeId];
×
55
        node.requestFocus(targetNode);
×
56
      } else {
57
        node.requestFocus();
4✔
58
      }
59
      return;
60
    }
61
    throw MissingFocusNodeException(
4✔
62
      nodeId,
63
      "requestFocus",
64
    );
65
  }
66

67
  @override
4✔
68
  void unfocus(
69
    String nodeId, {
70
    UnfocusDisposition disposition = UnfocusDisposition.scope,
71
  }) {
72
    final node = _nodeRegistry[nodeId];
8✔
73

74
    if (node != null) {
75
      node.unfocus(disposition: disposition);
4✔
76
      return;
77
    }
78
    throw MissingFocusNodeException(
4✔
79
      nodeId,
80
      "unfocus",
81
    );
82
  }
83

84
  @override
4✔
85
  void releaseResources() {
86
    for (var node in _nodeRegistry.entries) {
8✔
87
      node.value.dispose();
×
88
    }
89
    _nodeRegistry.clear();
8✔
90
  }
91

92
  @override
4✔
93
  @preferInline
94
  FocusNode? getNode(Object? key) => _nodeRegistry[key];
8✔
95

96
  @override
348✔
97
  void linkDriver(UIDriver driver) => _driver = driver;
348✔
98
}
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