2024-04-20 23:20:52 +00:00
|
|
|
import 'package:grpc/grpc.dart';
|
2024-04-21 18:58:45 +00:00
|
|
|
import 'package:path_provider/path_provider.dart';
|
2024-04-20 23:20:52 +00:00
|
|
|
import 'cw_mweb_platform_interface.dart';
|
|
|
|
import 'mwebd.pbgrpc.dart';
|
|
|
|
|
|
|
|
class CwMweb {
|
2024-04-21 18:58:45 +00:00
|
|
|
static Future<RpcClient> stub() async {
|
|
|
|
final appDir = await getApplicationSupportDirectory();
|
2024-04-21 11:19:44 +00:00
|
|
|
return RpcClient(ClientChannel('127.0.0.1',
|
2024-04-25 14:23:01 +00:00
|
|
|
port: await CwMwebPlatform.instance.start(appDir.path) ?? 0,
|
2024-04-20 23:20:52 +00:00
|
|
|
options: const ChannelOptions(
|
2024-04-21 11:19:44 +00:00
|
|
|
credentials: ChannelCredentials.insecure())));
|
2024-04-20 23:20:52 +00:00
|
|
|
}
|
|
|
|
}
|