'This package does not have flutter_web_plugins in the `dependencies` section of `pubspec.yaml`

When publishing my package after adding web support i got this error

Package validation found the following error:
* line 9, column 1 of lib/hexcolor_web.dart: This package does not have flutter_web_plugins in the `dependencies` section of `pubspec.yaml`.
    ╷
  9 │ import 'package:flutter_web_plugins/flutter_web_plugins.dart';
    │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


Solution 1:[1]

inside your pubspec.yaml

add this

dependencies:
  flutter:
    sdk: flutter
  flutter_web_plugins:
    sdk: flutter

Solution 2:[2]

If not findable inside flutter sdk like collection(in my case)

you can just add it as a normal package from pub.dev

dependencies:
  flutter:
    sdk: flutter
  collection:

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 griffins
Solution 2 Abdelazeem Kuratem