Search code examples
flutterdartflutter-testclean-architecturearchunit

ArchUnit / test architecture for Flutter or Dart


I'm developing an Flutter App using Clean Architecture. Now i'm looking for a library or something else like ArchUnit. To test the architecture and to ensure the correct access of packages.

How do you solve the problem and ensure compliance with the architecture. I would appreciate ideas or alternatives.


Solution

  • I have not found an Architest equivalent. Another way to ensure correct access to packages is to use a linter like the following

    analyzer:
        plugins:
            - import_lint
    
    import_lint:
        rules:
            use_case_rule:
                target_file_path: "/**/use_case/*_use_case.dart"
                not_allow_imports: ["/**/use_case/*_use_case.dart"]
                exclude_imports: ["/**/use_case/base_use_case.dart"]
    

    https://github.com/kawa1214/import-lint