In a flutter project, I'm following n-tier architecture. Where in a layer I don't want to allow importing files from the flutter framework. Is there a way to prevent importing files from flutter or any other layer?
I don't want to allow writing
import 'package:flutter/material.dart';
in my data and domain layer
I know this is a bit old but I don't see any answers yet, so I thought to share with you what I've found regarding the subject. There are several ways to enforce the imports in your Flutter project (I documented them in details here) :
analysis_options.yaml to enable linter rules that can be triggered when we don't respect package import and try to import things directly with relative paths.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With