Reputation: 5071
I often times import cupertino.dart
instead of material.dart
when having to import widgets because its the first suggested options.
Its not a real problem but for the sake of consistency I want to prevent importing cuppertino.dart
so it is not listed in the import suggestions and only use widgets.dart
or material.dart
instead.
Is there a way to configure Android Studio or Dart Analyzer to prevent cuppertino.dart
to show in suggestions?
Upvotes: 5
Views: 1017
Reputation: 351
You can create an export file with your exports inside and call this file afterwards.
For example create an exportsFile
:
export 'package:flutter/material.dart';
And now call this file when you wants:
import 'exportsFile.dart';
Upvotes: 1
Reputation: 17623
Seems no, but there is a workaround: You can write a linter to examine your code and warn (or error) whenever you see imports of cupertino.dart
. That linter can even automatically correct the code (by replacing cupertino with material).
Some methodology thoughts: I often want something to be automatically performed ("import material not cupertino" in your case); but later I realized it is hard or not exist yet, but some verifier is good enough ("manually import; but warn if you import the wrong one").
Upvotes: 1