LCOV - code coverage report
Current view: top level - domain/models - message_extension.model.dart (source / functions) Hit Total Coverage
Test: new_lcov.info Lines: 14 14 100.0 %
Date: 2022-02-05 16:49:32 Functions: 0 0 -

          Line data    Source code
       1             : // ignore_for_file: unnecessary_string_interpolations
       2             : 
       3             : part of './models.devicekit.dart';
       4             : 
       5             : extension PayloadX on Payload {
       6           2 :   bool isInvalid() {
       7          12 :     return error.code.isEmpty && result.value.isEmpty;
       8             :   }
       9             : 
      10           2 :   bool hasReportedErrors() {
      11           6 :     return error.code.isNotEmpty;
      12             :   }
      13             : }
      14             : 
      15             : extension MessageX on Message {
      16             :   //
      17           2 :   Future<Result> validation() async {
      18           2 :     final payload = this.payload;
      19             : 
      20           2 :     if (payload.isInvalid()) {
      21           1 :       throw PlatformException(
      22             :         code: 'connection-playload-invalid',
      23             :         message: 'Please, check our entrypoint container.',
      24             :         details: null,
      25             :       );
      26           2 :     } else if (payload.hasReportedErrors()) {
      27           1 :       throw PlatformException(
      28           2 :         code: payload.error.code,
      29           2 :         message: payload.error.message,
      30           2 :         details: payload.error.details,
      31             :       );
      32             :     } else {
      33           1 :       return payload.result;
      34             :     }
      35             :   }
      36             : }

Generated by: LCOV version 1.15