1

I am learning injectable library, What does preferRelativeImports property do?

@InjectableInit(  
  initializerName: r'$initGetIt', // default  
  preferRelativeImports: true, // --> this property  
  asExtension: false, // default  
)  

1 Answers1

0

At official dart linter documentation you could find the following:

Prefer relative imports for files in lib/.

When mixing relative and absolute imports it's possible to create confusion where the same member gets imported in two different ways. One way to avoid that is to ensure you consistently use relative imports for files withing the lib/ directory.

GOOD:

import 'bar.dart';

BAD:

import 'package:my_package/bar.dart';
Mohamed Kamel
  • 841
  • 10
  • 15