I am creating a flutter package. My flutter package contains a function that uses another external flutter package called 'crypto'. But the users of my flutter package do not want to use or install the crypto. So are there anyway to encapsulate the crypto inside my flutter package without asking the users to install it in order to use that functions in my package?

1

There are 1 best solutions below

4
On

You could export the crypto package from your own package. This is what packages such as freezed_annotation are doing for collection, json_annotation and meta packages.

// ...

export 'package:collection/collection.dart' show DeepCollectionEquality;
export 'package:json_annotation/json_annotation.dart';
export 'package:meta/meta.dart';

// ...

source