Merge pull request #2109 from famedly/krille/add-hint-to-init-vodozemac-in-native-implementations
chore: Add hint to init vodozemac also in native implementations
This commit is contained in:
commit
2cdc977c1b
13
CHANGELOG.md
13
CHANGELOG.md
|
|
@ -49,13 +49,22 @@ For Flutter you can use [flutter_vodozemac](https://pub.dev/packages/flutter_vod
|
||||||
just needs to be initialized **once**:
|
just needs to be initialized **once**:
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
import 'package:flutter_vodozemac/flutter_vodozemac' as vod;
|
import 'package:flutter_vodozemac/flutter_vodozemac.dart' as vod;
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
await vod.init();
|
await vod.init();
|
||||||
|
|
||||||
final client = Client(/*...*/);
|
final client = Client('Matrix Client',
|
||||||
|
// ...
|
||||||
|
// ...
|
||||||
|
nativeImplementations: NativeImplementationsIsolate(
|
||||||
|
compute,
|
||||||
|
// Also init in NativeImplemenetations if you use it there:
|
||||||
|
vodozemacInit: () => vod.init(),
|
||||||
|
),
|
||||||
|
// ...
|
||||||
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
This should work on Android, iOS, macOS, Linux and Windows.
|
This should work on Android, iOS, macOS, Linux and Windows.
|
||||||
|
|
|
||||||
|
|
@ -27,3 +27,20 @@ final client = Client(/*...*/);
|
||||||
This should work on Android, iOS, macOS, Linux and Windows.
|
This should work on Android, iOS, macOS, Linux and Windows.
|
||||||
|
|
||||||
For web you need to compile vodozemac to wasm. [Please refer to the Vodozemac bindings documentation](https://pub.dev/packages/vodozemac#build-for-web).
|
For web you need to compile vodozemac to wasm. [Please refer to the Vodozemac bindings documentation](https://pub.dev/packages/vodozemac#build-for-web).
|
||||||
|
|
||||||
|
### Using Vodozemac with NativeImplementations
|
||||||
|
|
||||||
|
When using NativeImplementations you have to initialize Vodozemac there as well.
|
||||||
|
Just pass the same init function to it:
|
||||||
|
|
||||||
|
```dart
|
||||||
|
final client = Client('Matrix Client',
|
||||||
|
// ...
|
||||||
|
// ...
|
||||||
|
nativeImplementations: NativeImplementationsIsolate(
|
||||||
|
compute,
|
||||||
|
vodozemacInit: () => vod.init(),
|
||||||
|
),
|
||||||
|
// ...
|
||||||
|
);
|
||||||
|
```
|
||||||
Loading…
Reference in New Issue