flutter_pear_test 0.3.1 copy "flutter_pear_test: ^0.3.1" to clipboard
flutter_pear_test: ^0.3.1 copied to clipboard

In-memory fake Pear swarm/worklet for unit-testing flutter_pear apps without radios or real peers.

example/README.md

Example #

In-memory fakes for unit-testing app code built on package:flutter_pear — no radios, no real peers, no worklet.

import 'package:flutter_pear/flutter_pear.dart';
import 'package:flutter_pear/src/rpc.dart';
import 'package:flutter_pear/src/schema.dart';
import 'package:flutter_pear_test/flutter_pear_test.dart';

final hub = FakeSwarmHub();
final rpcA = PearRpc(FakeBareWorklet(hub: hub));
final rpcB = PearRpc(FakeBareWorklet(hub: hub));
await rpcA.call(PearMethod.attachInfo);
await rpcB.call(PearMethod.attachInfo);

final topic = PearCrypto.unsafeTopicFromString('test-topic');
final swarmA = await PearSwarm.join(rpcA, topic);
final swarmB = await PearSwarm.join(rpcB, topic);
// swarmA/swarmB now see each other via swarmA.connections/swarmB.connections.
0
likes
160
points
65
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

In-memory fake Pear swarm/worklet for unit-testing flutter_pear apps without radios or real peers.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, flutter_pear, flutter_pear_bare

More

Packages that depend on flutter_pear_test