mad_lint 2.0.0 copy "mad_lint: ^2.0.0" to clipboard
mad_lint: ^2.0.0 copied to clipboard

A comprehensive Dart/Flutter lint plugin with rules for state management, resource disposal, and code quality.

example/mad_lint_example.dart

// Example demonstrating mad_lint rules
//
// To use mad_lint, add the following to your analysis_options.yaml:
//
// ```yaml
// plugins:
//   mad_lint: ^2.0.0
// ```

// ignore_for_file: unused_local_variable, unused_field

/// Example: no_magic_number rule
///
/// Magic numbers should be extracted to named constants.
void magicNumberExample() {
  // Bad: magic number
  // final padding = 16.0;

  // Good: named constant
  const kDefaultPadding = 16.0;
  final padding = kDefaultPadding;
}

/// Example: no_bang_operator rule
///
/// Avoid using the null assertion operator (!).
void bangOperatorExample(String? name) {
  // Bad: using bang operator
  // final value = name!;

  // Good: null-aware operator
  final value = name ?? 'Unknown';
}

/// Example: required_full_props rule (with Equatable)
///
/// All fields must be included in props getter.
// class UserState extends Equatable {
//   final String name;
//   final int age;
//
//   // Good: all fields included
//   @override
//   List<Object?> get props => [name, age];
// }
0
likes
150
points
9
downloads

Documentation

API reference

Publisher

verified publishermadbrains.ru

Weekly Downloads

A comprehensive Dart/Flutter lint plugin with rules for state management, resource disposal, and code quality.

Repository (GitHub)
View/report issues

Topics

#lint #analyzer #flutter #static-analysis

License

MIT (license)

Dependencies

analysis_server_plugin, analyzer, analyzer_plugin, args, collection

More

Packages that depend on mad_lint