Scorb
Scorb

Reputation: 1920

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

Upvotes: 3

Views: 2841

Answers (2)

MarlonDSC
MarlonDSC

Reputation: 343

Add your dependencies on

dependencies:

not on

dev_dependencies:

Upvotes: 6

user19451661
user19451661

Reputation: 9

Add the below line of code under dependencies in your pubspec.yaml file and run pub get.

dependencies:
    json_annotation: ^4.5.0

Upvotes: 0

Related Questions