match method

  1. @override
ProtectionDefinition? match(
  1. ProtectionType type,
  2. double rating,
  3. String curve,
  4. double sens,
)
override

Implementation

@override
ProtectionDefinition? match(
    ProtectionType type, double rating, String curve, double sens) {
  try {
    return getProtections().firstWhere((p) =>
        p.type == type &&
        p.ratingAmps == rating &&
        (type == ProtectionType.circuitBreaker
            ? p.curve == curve
            : p.sensitivityMa == sens));
  } catch (_) {
    return null;
  }
}