summary property

String get summary

Human-readable summary for list chips.

Implementation

String get summary {
  final k = key?.trim();
  final v = value?.trim();
  final targetLabel = switch (target) {
    InfospectBreakpointMatchTarget.queryParam => 'query',
    InfospectBreakpointMatchTarget.requestHeader => 'req header',
    InfospectBreakpointMatchTarget.requestBodyText => 'req body',
    InfospectBreakpointMatchTarget.requestBodyJson => 'req json',
    InfospectBreakpointMatchTarget.responseStatus => 'status',
    InfospectBreakpointMatchTarget.responseBodyText => 'res body',
    InfospectBreakpointMatchTarget.responseBodyJson => 'res json',
  };
  final opLabel = switch (op) {
    InfospectBreakpointMatchOp.exists => 'exists',
    InfospectBreakpointMatchOp.equals => '=',
    InfospectBreakpointMatchOp.contains => 'contains',
    InfospectBreakpointMatchOp.inRange => 'in',
  };
  if (op == InfospectBreakpointMatchOp.exists) {
    return '$targetLabel ${k ?? '?'} exists';
  }
  if (k != null && k.isNotEmpty) {
    return '$targetLabel $k $opLabel ${v ?? ''}';
  }
  return '$targetLabel $opLabel ${v ?? ''}';
}