LCOV - code coverage report
Current view: top level - core/models - feed_id.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 17 17 100.0 %
Date: 2021-04-14 08:03:52 Functions: 0 0 -

          Line data    Source code
       1             : import 'package:equatable/equatable.dart';
       2             : 
       3             : ///
       4             : class FeedId extends Equatable {
       5             :   ///
       6           8 :   FeedId(this.slug, this.userId)
       7           8 :       : assert(!slug.contains(':'), 'Invalid slug'),
       8           8 :         assert(!userId.contains(':'), 'Invalid userId');
       9             : 
      10             :   ///
      11           6 :   factory FeedId.id(String id) {
      12           6 :     assert(id.contains(':'), 'Invalid FeedId');
      13           6 :     final parts = id.split(':');
      14          12 :     assert(parts.length == 2, 'Invalid FeedId');
      15          18 :     return FeedId(parts[0], parts[1]);
      16             :   }
      17             : 
      18             :   ///
      19             :   final String slug;
      20             : 
      21             :   ///
      22             :   final String userId;
      23             : 
      24             :   ///
      25           4 :   String get claim => '$slug$userId';
      26             : 
      27             :   ///
      28           6 :   static List<FeedId>? fromIds(List? ids) =>
      29          24 :       ids?.map((e) => FeedId.id(e)).toList(growable: false);
      30             : 
      31             :   ///
      32           2 :   static List<String>? toIds(List<FeedId>? feeds) =>
      33           4 :       feeds?.map((e) => e.toString()).toList(growable: false);
      34             : 
      35           6 :   @override
      36          18 :   List<Object> get props => [slug, userId];
      37             : 
      38           3 :   @override
      39           9 :   String toString() => '$slug:$userId';
      40             : }

Generated by: LCOV version 1.15