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

Floating-Dartists / matomo-tracker / 6492014594

12 Oct 2023 06:19AM UTC coverage: 93.108%. First build
6492014594

Pull #124

github

web-flow
Merge 981f45404 into 27a0bf2df
Pull Request #124: chore: bump dependencies, fix formatting

743 of 798 relevant lines covered (93.11%)

2.87 hits per line

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

100.0
/lib/src/content.dart
1
import 'package:matomo_tracker/src/assert.dart';
2

3
/// Describes a content.
4
///
5
/// To track a content, first track [MatomoTracker.trackContentImpression], then,
6
/// if the user interacts with it, track [MatomoTracker.trackContentInteraction].
7
///
8
/// Read more about [Content Tracking](https://matomo.org/guide/reports/content-tracking/).
9
class Content {
10
  /// Describes a block of content.
11
  ///
12
  /// Note: Strings filled with whitespace will be considered as (invalid) empty
13
  /// values.
14
  factory Content({
3✔
15
    required String name,
16
    String? piece,
17
    String? target,
18
  }) {
19
    assertStringIsFilled(value: name, name: 'name');
3✔
20
    assertStringIsFilled(value: piece, name: 'piece');
3✔
21
    assertStringIsFilled(value: target, name: 'target');
3✔
22

23
    return Content._(
3✔
24
      name: name,
25
      piece: piece,
26
      target: target,
27
    );
28
  }
29

30
  const Content._({
3✔
31
    required this.name,
32
    this.piece,
33
    this.target,
34
  });
35

36
  /// The name of the content.
37
  ///
38
  /// For instance 'Ad Foo Bar'.
39
  ///
40
  /// Corresponds with `c_n`.
41
  final String name;
42

43
  /// The actual content piece.
44
  ///
45
  /// For instance the path to an image, video, audio, any text.
46
  ///
47
  /// Corresponds with `c_p`.
48
  final String? piece;
49

50
  /// The target of the content.
51
  ///
52
  /// For instance the URL of a landing page.
53
  ///
54
  /// Corresponds with `c_t`.
55
  final String? target;
56

57
  Map<String, String> toMap() {
3✔
58
    final cN = name;
3✔
59
    final cP = piece;
3✔
60
    final cT = target;
3✔
61

62
    return {
3✔
63
      'c_n': cN,
3✔
64
      if (cP != null) 'c_p': cP,
2✔
65
      if (cT != null) 'c_t': cT,
2✔
66
    };
67
  }
68
}
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