clx_flutter_message_web.dart 938 Bytes
Newer Older
张国庆's avatar
张国庆 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
// 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_web_plugins/flutter_web_plugins.dart';

import 'clx_flutter_message_platform_interface.dart';

/// A web implementation of the ClxFlutterMessagePlatform of the ClxFlutterMessage plugin.
class ClxFlutterMessageWeb extends ClxFlutterMessagePlatform {
  /// Constructs a ClxFlutterMessageWeb
  ClxFlutterMessageWeb();

  static void registerWith(Registrar registrar) {
    ClxFlutterMessagePlatform.instance = ClxFlutterMessageWeb();
  }

  /// Returns a [String] containing the version of the platform.
  @override
  Future<String?> getPlatformVersion() async {
    final version = html.window.navigator.userAgent;
    return version;
  }
}