'Why am I getting dart warning 'Depend on referenced packages'?

I have the following code...

import 'package:json_annotation/json_annotation.dart';

@JsonSerializable()
class MyClass {

}

The import statement at the top is giving the error 'Depend on referenced packages'.

I have no clue what this means. My pubspec.yaml is as follows...

name: my_app
description: A sample command-line application.
version: 1.0.0
# homepage: https://www.example.com

environment:
  sdk: '>=2.17.1 <3.0.0'

dependencies:
  dio: ^4.0.6
  json_serializable: ^6.2.0

dev_dependencies:
  lints: ^2.0.0
  test: ^1.16.0


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source