Function declares six or more parameters

ID

dart.maintainability.max_params

Severity

low

Remediation Complexity

medium

Remediation Risk

low

Remediation Effort

medium

Resource

Complexity

Language

Dart

Description

Reports a function or method whose parameter list holds six or more parameters, counting positional, optional and named ones alike. The threshold is fixed at six: the pattern names six parameters followed by an ellipsis, so longer lists match too.

Rationale

A long positional parameter list is easy to call incorrectly - two adjacent parameters of the same type can be transposed with no compile error and no warning, and every caller has to remember the order. It is also a reliable sign that the function carries more than one responsibility, or that some of the arguments belong together as a value of their own: six parameters usually contain a hidden object.

The following code illustrates the pattern detected by this rule:

class OrderService {
  // FLAGGED: Function declares six or more parameters
  void placeOrder(String sku, int quantity, double price, String currency,
      String address, bool giftWrap) {
    print('$sku $quantity $price $currency $address $giftWrap');
  }
}

Remediation

Group the related parameters into a class and pass one instance instead, or split the function so each part takes only what it needs. Where the extra arguments are optional configuration, Dart named parameters with defaults keep the call site readable and remove the ordering hazard entirely.

Configuration

This detector does not need any configuration.

© 2026 Xygeni. All rights reserved