projectName.dart.tmpl 796 Bytes
Newer Older
1 2 3 4 5 6 7
{{#no_platforms}}
// You have generated a new plugin project without
// specifying the `--platforms` flag. A plugin project supports no platforms is generated.
// To add platforms, run `flutter create -t plugin --platforms <platforms> .` under the same
// directory. You can also find a detailed instruction on how to add platforms in the `pubspec.yaml` at https://flutter.dev/docs/development/packages-and-plugins/developing-packages#plugin-platforms.
{{/no_platforms}}

8 9 10 11 12
import 'dart:async';

import 'package:flutter/services.dart';

class {{pluginDartClass}} {
13
  static const MethodChannel _channel = MethodChannel('{{projectName}}');
14

15 16
  static Future<String?> get platformVersion async {
    final String? version = await _channel.invokeMethod('getPlatformVersion');
17 18
    return version;
  }
19
}