@@ -13,8 +13,8 @@ web browser this package wraps the [`window.crypto`][window-crypto] APIs and
13
13
providing the same Dart API as the native implementation.
14
14
15
15
This way, ` package:webcrypto ` provides the same crypto API on multiple
16
- platforms. Initially targeting Flutter for ** Android** and ** Web ** , with ** iOS **
17
- and other platforms following as soon as the build system allows.
16
+ platforms. Initially targeting Flutter for ** Android** , ** iOS ** and ** Web ** ,
17
+ with other platforms following as soon as the build system allows.
18
18
19
19
** Example**
20
20
``` dart
@@ -51,6 +51,32 @@ Future<void> main() async {
51
51
For a discussion of the API design of this package,
52
52
see ` doc/design-rationale-md ` .
53
53
54
+ ## Use with ` flutter test `
55
+
56
+ Unlike most plugins it is possible to run code that uses ` package:webcrypto `
57
+ with ` flutter test ` . For this to work the native library must be built in the
58
+ application folder where ` flutter test ` is called. This can be done with:
59
+
60
+ ``` bash
61
+ # Only necessary when package:webcrypto is used from 'flutter test'
62
+ # This is not necessary for development with 'flutter run' and hot-reload
63
+ $ flutter pub run webcrypto:setup
64
+
65
+ # Now it's possible to run tests that uses package:webcrypto
66
+ $ flutter test test/my_test_file_using_webcrypto.dart
67
+ ```
68
+
69
+ This requires:
70
+ * ` cmake `
71
+ * a C compiler (like ` gcc ` or ` clang ` )
72
+ * Linux or Mac.
73
+
74
+ The native library will be stored in ` .dart_tool/webcrypto/ ` which should
75
+ _ not_ be under source control.
76
+
77
+ It is also possible to run tests with Flutter Web using
78
+ ` flutter test -p chrome ` , this does not require any additional setup steps.
79
+
54
80
## Limitations
55
81
This package has a few limitations compared to the
56
82
[ Web Cryptograph API] [ webcrypto-spec ] . For a discussion of parity with
0 commit comments