Home > Back-end >  Dart 2.17 has warning when using code snipplet
Dart 2.17 has warning when using code snipplet

Time:05-15

enter image description here

enter image description here

enter image description here

I just update dart sdk to 2.17 and when I use snipplet (in VScode) to auto generate code for Stateless/Stateful it auto import these two package.

But it tell me warning Don't import implementation files from another package. Is this normal?

CodePudding user response:

Why are you importing implementation files from Flutter? If you have Flutter setup right you do not need to import anything like this.

CodePudding user response:

You're importing files from a package's src directory. That is not normal. You're directly importing a package's internal, private files.

The analysis warning tells you the name of the warning (implementation_imports), and your IDE should allow you to click on it to get more details:

https://dart.dev/tools/linter-rules#implementation_imports

Instead use:

import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
  • Related