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

Duit-Foundation / flutter_duit / 19115039532

05 Nov 2025 08:15PM UTC coverage: 86.358% (+8.9%) from 77.409%
19115039532

push

github

web-flow
major: flutter_duit v4 (#310)

2151 of 2405 new or added lines in 109 files covered. (89.44%)

36 existing lines in 7 files now uncovered.

3773 of 4369 relevant lines covered (86.36%)

35.87 hits per line

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

71.43
/lib/src/utils/component_builder.dart
1
import 'package:duit_kernel/duit_kernel.dart';
2

3
/// Builds a concrete component instance JSON by applying precomputed
4
/// write operations to the immutable base layout using JSON Patch.
5
final class ComponentBuilder {
6
  static Map<String, dynamic> build(
20✔
7
    ComponentDescription description,
8
    Map<String, dynamic> data, {
9
    bool ensureIntermediate = true,
10
  }) {
11
    final ops = <PatchOp>[];
20✔
12

13
    for (final t in description.writeOps) {
24✔
14
      final has = data.containsKey(t.sourceKey);
8✔
15
      final value = has ? data[t.sourceKey] : t.defaultValue;
12✔
16

17
      switch (t.semantics) {
4✔
18
        case PatchSemantics.replace:
4✔
19
          if (value != null) {
20
            ops.add(PatchOps.replace(path: t.path, value: value));
12✔
21
          } else {
22
            // Rm if null?
23
            // ops.add(PatchOps.remove(path: t.path));
24
          }
25
          break;
NEW
26
        case PatchSemantics.add:
×
27
          if (value != null) {
NEW
28
            ops.add(PatchOps.add(path: t.path, value: value));
×
29
          }
30
          break;
NEW
31
        case PatchSemantics.remove:
×
NEW
32
          ops.add(PatchOps.remove(path: t.path));
×
33
          break;
34
      }
35
    }
36

37
    return JsonPatchApplier.apply(
20✔
38
      description.data,
20✔
39
      ops,
40
      ensureIntermediate: ensureIntermediate,
41
    );
42
  }
43
}
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