LCOV - code coverage report
Current view: top level - code_generators/instances - function_instance.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 11 13 84.6 %
Date: 2021-10-30 14:58:50 Functions: 0 0 -

          Line data    Source code
       1             : import 'package:collection/collection.dart';
       2             : import 'package:meta/meta.dart';
       3             : 
       4             : import 'package:widgetbook_generator/code_generators/instances/base_instance.dart';
       5             : 
       6             : @immutable
       7             : class FunctionInstance extends BaseInstance {
       8           4 :   const FunctionInstance({
       9             :     required this.name,
      10             :     this.parameters = const <String>[],
      11             :   });
      12             : 
      13             :   final String name;
      14             :   final List<String> parameters;
      15             : 
      16           1 :   String _parametersToCode() {
      17           2 :     return parameters.join(', ');
      18             :   }
      19             : 
      20           1 :   @override
      21             :   String toCode() {
      22           1 :     final parameters = _parametersToCode();
      23           2 :     return '($parameters) => $name($parameters)';
      24             :   }
      25             : 
      26           2 :   @override
      27             :   bool operator ==(Object other) {
      28             :     if (identical(this, other)) return true;
      29           2 :     final listEquals = const DeepCollectionEquality().equals;
      30             : 
      31           2 :     return other is FunctionInstance &&
      32           6 :         other.name == name &&
      33           4 :         listEquals(other.parameters, parameters);
      34             :   }
      35             : 
      36           0 :   @override
      37           0 :   int get hashCode => name.hashCode ^ parameters.hashCode;
      38             : }

Generated by: LCOV version 1.15