|
@@ -10,13 +10,14 @@ import 'dart:io';
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
|
class ComPDFKit {
|
|
|
- static const MethodChannel _methodChannel = MethodChannel('com.compdfkit.flutter.plugin');
|
|
|
+ static const MethodChannel _methodChannel =
|
|
|
+ MethodChannel('com.compdfkit.flutter.plugin');
|
|
|
|
|
|
static const initSDK = 'init_sdk';
|
|
|
static const sdkVersionCode = 'sdk_version_code';
|
|
|
static const sdkBuildTag = "sdk_build_tag";
|
|
|
|
|
|
- /// init ComPDFKit sdk, please enter your ComPDFKit key and secret
|
|
|
+ /// init ComPDFKit sdk, please enter your ComPDFKit [key] and [secret]
|
|
|
static void init(String key, String secret) async {
|
|
|
_methodChannel.invokeMethod(initSDK, {'key': key, 'secret': secret});
|
|
|
}
|
|
@@ -28,20 +29,24 @@ class ComPDFKit {
|
|
|
return versionCode;
|
|
|
}
|
|
|
|
|
|
+ /// get ComPDFKit SDK build tag info
|
|
|
static Future<String> getSDKBuildTag() async {
|
|
|
String buildTag = await _methodChannel.invokeMethod(ComPDFKit.sdkBuildTag);
|
|
|
return buildTag;
|
|
|
}
|
|
|
|
|
|
+ /// Pass in the local file path of the PDF document and display it within a newly opened view.
|
|
|
static void openDocument(String document) async {
|
|
|
await _methodChannel.invokeMethod('openDocument', document);
|
|
|
}
|
|
|
|
|
|
+ /// Retrieve the temporary directory path of the currently running platform.
|
|
|
+ /// Currently, only [Android] and [IOS] are supported.
|
|
|
static Future<Directory> getTemporaryDirectory() async {
|
|
|
- final String? path = await _methodChannel.invokeMethod('getTemporaryDirectory');
|
|
|
+ final String? path =
|
|
|
+ await _methodChannel.invokeMethod('getTemporaryDirectory');
|
|
|
if (path == null) {
|
|
|
- throw Exception(
|
|
|
- 'Unable to get temporary directory');
|
|
|
+ throw Exception('Unable to get temporary directory');
|
|
|
}
|
|
|
return Directory(path);
|
|
|
}
|