From f216948ce40a845411178e43809c591014788130 Mon Sep 17 00:00:00 2001 From: Jonas Finnemann Jensen Date: Fri, 18 Sep 2020 22:32:17 +0200 Subject: [PATCH] Updated readme for 0.2.0 release --- README.md | 30 ++++++++++++++++++++++++++++-- example/pubspec.lock | 4 ++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4637e7bc..966bf7a5 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,8 @@ web browser this package wraps the [`window.crypto`][window-crypto] APIs and providing the same Dart API as the native implementation. This way, `package:webcrypto` provides the same crypto API on multiple -platforms. Initially targeting Flutter for **Android** and **Web**, with **iOS** -and other platforms following as soon as the build system allows. +platforms. Initially targeting Flutter for **Android**, **iOS** and **Web**, +with other platforms following as soon as the build system allows. **Example** ```dart @@ -51,6 +51,32 @@ Future main() async { For a discussion of the API design of this package, see `doc/design-rationale-md`. +## Use with `flutter test` + +Unlike most plugins it is possible to run code that uses `package:webcrypto` +with `flutter test`. For this to work the native library must be built in the +application folder where `flutter test` is called. This can be done with: + +```bash +# Only necessary when package:webcrypto is used from 'flutter test' +# This is not necessary for development with 'flutter run' and hot-reload +$ flutter pub run webcrypto:setup + +# Now it's possible to run tests that uses package:webcrypto +$ flutter test test/my_test_file_using_webcrypto.dart +``` + +This requires: + * `cmake` + * a C compiler (like `gcc` or `clang`) + * Linux or Mac. + +The native library will be stored in `.dart_tool/webcrypto/` which should +_not_ be under source control. + +It is also possible to run tests with Flutter Web using +`flutter test -p chrome`, this does not require any additional setup steps. + ## Limitations This package has a few limitations compared to the [Web Cryptograph API][webcrypto-spec]. For a discussion of parity with diff --git a/example/pubspec.lock b/example/pubspec.lock index 7fc0198c..0f374edc 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -478,7 +478,7 @@ packages: path: ".." relative: true source: path - version: "0.1.2" + version: "0.2.0" webdriver: dependency: transitive description: @@ -502,4 +502,4 @@ packages: version: "2.2.1" sdks: dart: ">=2.9.0-14.0.dev <3.0.0" - flutter: ">=1.17.0" + flutter: ">=1.17.0 <2.0.0"