2022-01-16 11:19:01 -05:00
|
|
|
import 'dart:async';
|
|
|
|
// In order to *not* need this ignore, consider extracting the "web" version
|
|
|
|
// of your plugin as a separate package, instead of inlining it in the same
|
|
|
|
// package as the core of your plugin.
|
|
|
|
// ignore: avoid_web_libraries_in_flutter
|
|
|
|
import 'dart:html' as html show window;
|
|
|
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
|
|
|
|
|
2022-01-29 13:23:10 -05:00
|
|
|
// xxx link in WASM version of veilid-flutter
|
|
|
|
|
2022-01-16 11:19:01 -05:00
|
|
|
/// A web implementation of the Veilid plugin.
|
|
|
|
class VeilidWeb {
|
|
|
|
static void registerWith(Registrar registrar) {
|
2022-01-29 13:23:10 -05:00
|
|
|
// final MethodChannel channel = MethodChannel(
|
|
|
|
// 'veilid',
|
|
|
|
// const StandardMethodCodec(),
|
|
|
|
// registrar,
|
|
|
|
// );
|
2022-01-16 11:19:01 -05:00
|
|
|
|
2022-01-29 13:23:10 -05:00
|
|
|
// final pluginInstance = VeilidWeb();
|
|
|
|
// channel.setMethodCallHandler(pluginInstance.handleMethodCall);
|
2022-01-16 11:19:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Handles method calls over the MethodChannel of this plugin.
|
|
|
|
/// Note: Check the "federated" architecture for a new way of doing this:
|
|
|
|
/// https://flutter.dev/go/federated-plugins
|
|
|
|
Future<dynamic> handleMethodCall(MethodCall call) async {
|
2022-01-29 13:23:10 -05:00
|
|
|
// switch (call.method) {
|
|
|
|
// case 'getPlatformVersion':
|
|
|
|
// return getPlatformVersion();
|
|
|
|
// default:
|
2022-01-16 11:19:01 -05:00
|
|
|
throw PlatformException(
|
|
|
|
code: 'Unimplemented',
|
|
|
|
details: 'veilid for web doesn\'t implement \'${call.method}\'',
|
|
|
|
);
|
2022-01-29 13:23:10 -05:00
|
|
|
// }
|
2022-01-16 11:19:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|