mix_lint 2.0.1 copy "mix_lint: ^2.0.1" to clipboard
mix_lint: ^2.0.1 copied to clipboard

Analyzer plugin with lint rules and quick fixes for Mix, the Flutter styling framework. Catches Styler, variant, and design-token mistakes.

example/example.md

mix_lint example #

Enable the plugin and the lints in analysis_options.yaml:

plugins:
  mix_lint:
    version: ^2.0.1
    diagnostics:
      base_style_after_variant: true
      inline_token_definition: true
      long_styler_chain: true
      unnecessary_styler_constructor: true
      unnecessary_type_name: true
      variants_without_base_style: true

With that config, the analyzer reports each commented line below:

import 'package:flutter/material.dart';
import 'package:mix/mix.dart';

final $primary = ColorToken('primary');

// variants_without_base_style
final hoverOnly = BoxStyler().onHovered(.color(Colors.blue));

// base_style_after_variant
final card = BoxStyler()
    .color(Colors.white)
    .onHovered(.color(Colors.blue))
    .padding(.all(16));

// unnecessary_styler_constructor (quick fix: `.onHovered(.color(...))`)
final button = BoxStyler()
    .color(Colors.white)
    .onHovered(BoxStyler().color(Colors.blue));

// unnecessary_type_name (quick fix: `.all(16)`)
final padded = BoxStyler().padding(EdgeInsetsGeometryMix.all(16));

// inline_token_definition
final accent = BoxStyler().color(ColorToken('accent')());

// token_reference_outside_mix (a warning, on by default)
final swatch = Container(color: $primary());
0
likes
160
points
221
downloads

Documentation

API reference

Publisher

verified publisherleoafarias.com

Weekly Downloads

Analyzer plugin with lint rules and quick fixes for Mix, the Flutter styling framework. Catches Styler, variant, and design-token mistakes.

Homepage
Repository (GitHub)
View/report issues

Topics

#lints #analyzer #flutter #design-system

License

BSD-3-Clause (license)

Dependencies

analysis_server_plugin, analyzer, yaml

More

Packages that depend on mix_lint