Skip to content

[linter] avoid_dynamic_construtor_arguments #59785

@stephane-archer

Description

@stephane-archer

Is there any lint to avoid dynamic constructor arguments?

class FavoriteFoldersCardWidget extends StatelessWidget {
  final TextStyle _h1;

  const FavoriteFoldersCardWidget({
    super.key,
    required h1, // this is dynamic by mistake
  }) : _h1 = h1;

  @override
  Widget build(BuildContext context) {
    return Card(
      surfaceTintColor: Colors.blue,
      child: Padding(
        padding: const EdgeInsets.all(15.0),
        child: Text("hello word", style: _h1),
      ),
    );
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4area-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packagetype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions