projectName.dart.tmpl 806 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 14
  static const MethodChannel _channel =
      const MethodChannel('{{projectName}}');
15

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