├── .github
├── FUNDING.yml
├── stale.yml
└── workflows
│ ├── checker.yml
│ ├── pub_dry_run.yml
│ ├── pub_publish.yml
│ └── pub_publish_manually.yml
├── .gitignore
├── .metadata
├── CHANGELOG.md
├── CODEOWNERS
├── LICENSE
├── README.md
├── analysis_options.yaml
├── android
├── .gitignore
├── build.gradle
├── settings.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── com
│ └── fluttercandies
│ └── plugins
│ └── ff_native_screenshot
│ ├── FfNativeScreenshotPlugin.java
│ ├── ScreenshotApi.java
│ └── ScreenshotDetector.java
├── example
├── .gitignore
├── .metadata
├── README.md
├── analysis_options.yaml
├── lib
│ └── main.dart
└── pubspec.yaml
├── ios
├── .gitignore
├── Assets
│ └── .gitkeep
├── Classes
│ ├── FfNativeScreenshotPlugin.h
│ ├── FfNativeScreenshotPlugin.m
│ ├── ScreenshotApi.h
│ └── ScreenshotApi.m
└── ff_native_screenshot.podspec
├── lib
├── ff_native_screenshot.dart
└── src
│ └── ff_native_screenshot.dart
├── pigeon.sh
├── pigeons
└── ff_native_screenshot.dart
└── pubspec.yaml
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | # github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | #patreon: # Replace with a single Patreon username
5 | #open_collective: # Replace with a single Open Collective username
6 | #ko_fi: # Replace with a single Ko-fi username
7 | #tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | #community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: zmtzawqlp
10 | #issuehunt: # Replace with a single IssueHunt username
11 | #otechie: # Replace with a single Otechie username
12 | custom: http://zmtzawqlp.gitee.io/my_images/images/qrcode.png
13 |
--------------------------------------------------------------------------------
/.github/stale.yml:
--------------------------------------------------------------------------------
1 | # Number of days of inactivity before an issue becomes stale
2 | daysUntilStale: 30
3 | # Number of days of inactivity before a stale issue is closed
4 | daysUntilClose: 7
5 | # Issues with these labels will never be considered stale
6 | exemptLabels:
7 | - pinned
8 | - security
9 | # Label to use when marking an issue as stale
10 | staleLabel: wontfix
11 | # Comment to post when marking an issue as stale. Set to `false` to disable
12 | markComment: >
13 | This issue has been automatically marked as stale because it has not had
14 | recent activity. It will be closed if no further activity occurs. Thank you
15 | for your contributions.
16 | # Comment to post when closing a stale issue. Set to `false` to disable
17 | closeComment: true
--------------------------------------------------------------------------------
/.github/workflows/checker.yml:
--------------------------------------------------------------------------------
1 | name: No Free usage issue checker
2 |
3 | on:
4 | issues:
5 | types: [opened, reopened]
6 |
7 | jobs:
8 | build:
9 |
10 | runs-on: ubuntu-latest
11 |
12 | steps:
13 | - uses: actions/checkout@v2
14 | - name: Check issue actor
15 | uses: ./
16 | with:
17 | repo: $GITHUB_REPOSITORY
18 | user: $GITHUB_ACTOR
19 | token: ${{ secrets.GITHUB_TOKEN }}
--------------------------------------------------------------------------------
/.github/workflows/pub_dry_run.yml:
--------------------------------------------------------------------------------
1 | name: Pub Publish dry run
2 |
3 | on: [push]
4 |
5 | jobs:
6 | publish:
7 |
8 | runs-on: ubuntu-latest
9 |
10 | steps:
11 | - name: Checkout
12 | uses: actions/checkout@v1
13 | - name: Publish
14 | uses: sakebook/actions-flutter-pub-publisher@v1.3.0
15 | with:
16 | credential: ${{ secrets.CREDENTIAL_JSON }}
17 | flutter_package: true
18 | skip_test: true
19 | dry_run: true
20 |
--------------------------------------------------------------------------------
/.github/workflows/pub_publish.yml:
--------------------------------------------------------------------------------
1 | name: Pub Publish plugin
2 |
3 | on:
4 | release:
5 | types: [published]
6 |
7 | jobs:
8 | publish:
9 |
10 | runs-on: ubuntu-latest
11 |
12 | steps:
13 | - name: Checkout
14 | uses: actions/checkout@v1
15 | - name: Publish
16 | uses: sakebook/actions-flutter-pub-publisher@v1.3.0
17 | with:
18 | credential: ${{ secrets.CREDENTIAL_JSON }}
19 | flutter_package: true
20 | skip_test: true
21 | dry_run: false
22 |
--------------------------------------------------------------------------------
/.github/workflows/pub_publish_manually.yml:
--------------------------------------------------------------------------------
1 | name: Pub Publish plugin
2 |
3 | on: workflow_dispatch
4 |
5 | jobs:
6 | publish:
7 |
8 | runs-on: ubuntu-latest
9 |
10 | steps:
11 | - name: Checkout
12 | uses: actions/checkout@v1
13 | - name: Publish
14 | uses: sakebook/actions-flutter-pub-publisher@v1.3.0
15 | with:
16 | credential: ${{ secrets.CREDENTIAL_JSON }}
17 | flutter_package: true
18 | skip_test: true
19 | dry_run: false
20 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
25 | /pubspec.lock
26 | **/doc/api/
27 | .dart_tool/
28 | .packages
29 | build/
30 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: 7e9793dee1b85a243edd0e06cb1658e98b077561
8 | channel: stable
9 |
10 | project_type: plugin
11 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 1.0.0
2 |
3 | * android: breaking change, need READ_EXTERNAL_STORAGE permission for android now(some android versions need it).
4 | * android: ContentObserver instead of FileObserver
5 | * android: avoid multiple triggers
6 |
7 | ## 0.0.4
8 |
9 | * change Screenshot ImageType from JPEG to PNG on Android
10 |
11 | ## 0.0.3
12 |
13 | * dispose screenshotFlutterApi when onDetachedFromEngine
14 |
15 | ## 0.0.2
16 |
17 | * dart format
18 |
19 | ## 0.0.1
20 |
21 | * support to take or listen screenshot(support Platform Views)
22 |
--------------------------------------------------------------------------------
/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @zmtzawqlp
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 zmtzawqlp
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ff_native_screenshot
2 |
3 | A Flutter plugin to take or listen screenshot(support Platform Views) for Android and iOS with native code.
4 |
5 | It's a workaround for the issue [RepaintBoundary can't take screenshot of Platform Views](https://github.com/flutter/flutter/issues/102866) .
6 |
7 | [](https://pub.dartlang.org/packages/ff_native_screenshot) [](https://github.com/fluttercandies/ff_native_screenshot/stargazers) [](https://github.com/fluttercandies/ff_native_screenshot/network) [](https://github.com/fluttercandies/ff_native_screenshot/blob/master/LICENSE) [](https://github.com/fluttercandies/ff_native_screenshot/issues)
8 |
9 | ## Usage
10 |
11 | ``` yaml
12 | dependencies:
13 | ff_native_screenshot: any
14 | # only for android
15 | permission_handler: any
16 | ```
17 |
18 | ## Take Screenshot
19 |
20 | ``` dart
21 | Uint8List? data = await FfNativeScreenshot().takeScreenshot();
22 | ```
23 |
24 | ## Listen Screenshot
25 |
26 | ``` dart
27 |
28 | @override
29 | void initState() {
30 | super.initState();
31 | init();
32 | }
33 |
34 | Future init() async {
35 | if (Platform.isAndroid) {
36 | await Permission.storage.request();
37 | }
38 | FfNativeScreenshot().setup(ScreenshotFlutterApiImplements(context));
39 | await FfNativeScreenshot().startListeningScreenshot();
40 |
41 | if (mounted) {
42 | setState(() {});
43 | }
44 | }
45 |
46 | @override
47 | void dispose() {
48 | FfNativeScreenshot().stopListeningScreenshot();
49 | super.dispose();
50 | }
51 |
52 | bool? listening;
53 | @override
54 | void didChangeAppLifecycleState(AppLifecycleState state) {
55 | super.didChangeAppLifecycleState(state);
56 | switch (state) {
57 | case AppLifecycleState.resumed:
58 | if (listening == true && !FfNativeScreenshot().listening) {
59 | FfNativeScreenshot().startListeningScreenshot();
60 | }
61 | break;
62 | case AppLifecycleState.paused:
63 | listening = FfNativeScreenshot().listening;
64 | if (listening == true) {
65 | FfNativeScreenshot().stopListeningScreenshot();
66 | }
67 |
68 | break;
69 | default:
70 | }
71 | }
72 |
73 | class ScreenshotFlutterApiImplements extends ScreenshotFlutterApi {
74 | ScreenshotFlutterApiImplements();
75 | @override
76 | Future onTakeScreenshot(Uint8List? data) async {
77 | // if it has something error
78 | // you can call takeScreenshot
79 | data ??= await FfNativeScreenshot().takeScreenshot();
80 | }
81 | }
82 |
83 | ```
84 |
85 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:flutter_lints/flutter.yaml
2 |
3 | # Additional information about this file can be found at
4 | # https://dart.dev/guides/language/analysis-options
5 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | group 'com.fluttercandies.plugins.ff_native_screenshot'
2 | version '1.0'
3 |
4 | buildscript {
5 | repositories {
6 | google()
7 | mavenCentral()
8 | }
9 |
10 | dependencies {
11 | classpath 'com.android.tools.build:gradle:4.1.0'
12 | }
13 | }
14 |
15 | rootProject.allprojects {
16 | repositories {
17 | google()
18 | mavenCentral()
19 | }
20 | }
21 |
22 | apply plugin: 'com.android.library'
23 |
24 | android {
25 | compileSdkVersion 31
26 |
27 | compileOptions {
28 | sourceCompatibility JavaVersion.VERSION_1_8
29 | targetCompatibility JavaVersion.VERSION_1_8
30 | }
31 |
32 | defaultConfig {
33 | minSdkVersion 16
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'ff_native_screenshot'
2 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/src/main/java/com/fluttercandies/plugins/ff_native_screenshot/FfNativeScreenshotPlugin.java:
--------------------------------------------------------------------------------
1 | package com.fluttercandies.plugins.ff_native_screenshot;
2 |
3 | import android.app.Activity;
4 | import android.app.Application;
5 | import android.content.Context;
6 | import android.graphics.Bitmap;
7 | import android.graphics.Canvas;
8 | import android.graphics.Rect;
9 | import android.os.Build;
10 | import android.os.Bundle;
11 | import android.os.Environment;
12 | import android.os.FileObserver;
13 | import android.os.Handler;
14 | import android.os.Looper;
15 | import android.util.Log;
16 | import android.view.PixelCopy;
17 | import android.view.View;
18 | import android.view.Window;
19 | import android.webkit.MimeTypeMap;
20 |
21 | import androidx.annotation.NonNull;
22 | import androidx.annotation.Nullable;
23 |
24 | import java.io.ByteArrayOutputStream;
25 | import java.io.File;
26 | import java.io.FileInputStream;
27 | import java.util.ArrayList;
28 | import java.util.List;
29 |
30 | import io.flutter.embedding.engine.plugins.FlutterPlugin;
31 | import kotlin.jvm.internal.Intrinsics;
32 |
33 | /**
34 | * FfNativeScreenshotPlugin
35 | */
36 | public class FfNativeScreenshotPlugin implements FlutterPlugin, ScreenshotApi.ScreenshotHostApi {
37 |
38 | private ScreenshotApi.ScreenshotFlutterApi screenshotFlutterApi;
39 | private Context context;
40 | private ActivityLifecycleCallbacks callbacks = new ActivityLifecycleCallbacks();
41 | private Handler handler;
42 | //private FileObserver fileObserver;
43 | private ScreenshotDetector detector;
44 | //private String lastScreenshotFileName;
45 |
46 | @Override
47 | public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
48 | ScreenshotApi.ScreenshotHostApi.setup(flutterPluginBinding.getBinaryMessenger(), this);
49 | screenshotFlutterApi = new ScreenshotApi.ScreenshotFlutterApi(flutterPluginBinding.getBinaryMessenger());
50 | context = flutterPluginBinding.getApplicationContext();
51 | if (context instanceof Application) {
52 | Application application = (Application) context;
53 | application.registerActivityLifecycleCallbacks(callbacks);
54 | }
55 | }
56 |
57 |
58 | @Override
59 | public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
60 | ScreenshotApi.ScreenshotHostApi.setup(binding.getBinaryMessenger(), null);
61 | screenshotFlutterApi = null;
62 | }
63 |
64 |
65 | @Override
66 | public void takeScreenshot(ScreenshotApi.Result result) {
67 |
68 | // ActivityManager am = (ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);
69 | // ComponentName cn = am.getRunningTasks(1).get(0).topActivity;
70 | if (callbacks.currentActivity != null) {
71 | Activity activity = callbacks.currentActivity;
72 | Window window = activity.getWindow();
73 | View view = window.getDecorView();
74 | final Bitmap bitmap;
75 | try {
76 | if (Build.VERSION.SDK_INT >= 26) {
77 | bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
78 | int[] location = new int[2];
79 | view.getLocationInWindow(location);
80 | PixelCopy.request(window, new Rect(location[0], location[1], location[0] + view.getWidth(), location[1] + view.getHeight()), bitmap, (PixelCopy.OnPixelCopyFinishedListener) (new PixelCopy.OnPixelCopyFinishedListener() {
81 | public final void onPixelCopyFinished(int it) {
82 | if (it == 0) {
83 | takeScreenshotResult(bitmap, result);
84 | } else {
85 | result.error(new Exception("fail to take screenshot"));
86 | }
87 | }
88 | }), new Handler(Looper.getMainLooper()));
89 | } else {
90 | bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.RGB_565);
91 | Canvas canvas = new Canvas(bitmap);
92 | view.draw(canvas);
93 | canvas.setBitmap((Bitmap) null);
94 | Intrinsics.checkNotNullExpressionValue(bitmap, "tBitmap");
95 | takeScreenshotResult(bitmap, result);
96 | }
97 |
98 | } catch (Exception e) {
99 | Log.e("takeScreenshot", e.getMessage());
100 | result.error(e);
101 | } finally {
102 |
103 | }
104 | } else {
105 | result.success(null);
106 | }
107 | }
108 |
109 | @Override
110 | public void startListeningScreenshot() {
111 | handler = new Handler(Looper.getMainLooper());
112 |
113 | detector = new ScreenshotDetector(context, () -> {
114 | handler.post(() -> {
115 | onTakeScreenshot();
116 | });
117 | });
118 | detector.start();
119 | //
120 | // if (Build.VERSION.SDK_INT >= 29) {
121 | // final List files = new ArrayList<>();
122 | // final List paths = new ArrayList<>();
123 | // for (Path path : Path.values()) {
124 | // files.add(new File(path.getPath()));
125 | // paths.add(path.getPath());
126 | // }
127 | // fileObserver = new FileObserver(files) {
128 | // @Override
129 | // public void onEvent(int event, final String filename) {
130 | // if (event == FileObserver.CREATE) {
131 | // handler.post(() -> {
132 | // for (String fullPath : paths) {
133 | // File file = new File(fullPath + filename);
134 | // handleScreenshot(file);
135 | // }
136 | // });
137 | // }
138 | // }
139 | // };
140 | // fileObserver.startWatching();
141 | // } else {
142 | // for (final Path path : Path.values()) {
143 | // fileObserver = new FileObserver(path.getPath()) {
144 | // @Override
145 | // public void onEvent(int event, final String filename) {
146 | //
147 | // File file = new File(path.getPath() + filename);
148 | // if (event == FileObserver.CREATE) {
149 | // handler.post(() -> {
150 | // handleScreenshot(file);
151 | // });
152 | // }
153 | // }
154 | // };
155 | // fileObserver.startWatching();
156 | // }
157 | // }
158 | }
159 |
160 | // private void handleScreenshot(File file) {
161 | // if (file.exists()) {
162 | // String path = file.getPath();
163 | // if (lastScreenshotFileName!=path && getMimeType(file.getPath()).contains("image")) {
164 | // lastScreenshotFileName = path;
165 | // onTakeScreenshot();
166 | // }
167 | // }
168 | // }
169 |
170 | @Override
171 | public void stopListeningScreenshot() {
172 |
173 | // if (fileObserver != null) fileObserver.stopWatching();
174 | // lastScreenshotFileName = null;
175 | if (detector != null) {
176 | detector.stop();
177 | detector = null;
178 | }
179 | }
180 |
181 | private void takeScreenshotResult(Bitmap bitmap, ScreenshotApi.Result result) {
182 | ByteArrayOutputStream stream = new ByteArrayOutputStream();
183 | bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
184 | byte[] imageInByte = stream.toByteArray();
185 | result.success(imageInByte);
186 | }
187 |
188 | private void onTakeScreenshot(String path) {
189 | try {
190 | File imageFile = new File(path);
191 | FileInputStream inputStream = new FileInputStream(imageFile);
192 | byte[] buffer = new byte[1024];
193 | ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
194 | int len = 0;
195 | while ((len = inputStream.read(buffer)) != -1) {
196 | outputStream.write(buffer, 0, len);
197 | }
198 | byte[] imageInByte = outputStream.toByteArray();
199 | if (screenshotFlutterApi != null) {
200 | screenshotFlutterApi.onTakeScreenshot(imageInByte, (v) -> {
201 | });
202 | }
203 | } catch (Exception e) {
204 | Log.e("onTakeScreenshot", e.getMessage());
205 | } finally {
206 |
207 | }
208 | }
209 |
210 |
211 | private void onTakeScreenshot() {
212 | takeScreenshot(new TakeScreenshotResult());
213 | }
214 |
215 | class TakeScreenshotResult implements ScreenshotApi.Result {
216 | @Override
217 | public void success(byte[] result) {
218 | if (screenshotFlutterApi != null) {
219 | screenshotFlutterApi.onTakeScreenshot(result, (v) -> {
220 | });
221 | }
222 | }
223 |
224 | @Override
225 | public void error(Throwable error) {
226 | Log.e("takeScreenshot", error.getMessage());
227 | }
228 | }
229 |
230 | class ActivityLifecycleCallbacks implements Application.ActivityLifecycleCallbacks {
231 |
232 | private Activity currentActivity;
233 |
234 | @Override
235 | public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle savedInstanceState) {
236 |
237 | }
238 |
239 | @Override
240 | public void onActivityStarted(@NonNull Activity activity) {
241 |
242 | }
243 |
244 | @Override
245 | public void onActivityResumed(@NonNull Activity activity) {
246 | currentActivity = activity;
247 | }
248 |
249 | @Override
250 | public void onActivityPaused(@NonNull Activity activity) {
251 |
252 | }
253 |
254 | @Override
255 | public void onActivityStopped(@NonNull Activity activity) {
256 | if (currentActivity == activity) {
257 | currentActivity = null;
258 | }
259 | }
260 |
261 | @Override
262 | public void onActivitySaveInstanceState(@NonNull Activity activity, @NonNull Bundle outState) {
263 |
264 | }
265 |
266 | @Override
267 | public void onActivityDestroyed(@NonNull Activity activity) {
268 |
269 | }
270 | }
271 |
272 | public static String getMimeType(String url) {
273 | String type = null;
274 | String extension = MimeTypeMap.getFileExtensionFromUrl(url);
275 | if (extension != null) {
276 | type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
277 | }
278 | return type;
279 | }
280 |
281 | public enum Path {
282 | DCIM(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM) + File.separator + "Screenshots" + File.separator),
283 | PICTURES(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + File.separator + "Screenshots" + File.separator);
284 |
285 | final private String path;
286 |
287 | public String getPath() {
288 | return path;
289 | }
290 |
291 | Path(String path) {
292 | this.path = path;
293 | }
294 | }
295 | }
296 |
297 |
--------------------------------------------------------------------------------
/android/src/main/java/com/fluttercandies/plugins/ff_native_screenshot/ScreenshotApi.java:
--------------------------------------------------------------------------------
1 | // Autogenerated from Pigeon (v3.1.0), do not edit directly.
2 | // See also: https://pub.dev/packages/pigeon
3 |
4 | package com.fluttercandies.plugins.ff_native_screenshot;
5 |
6 | import android.util.Log;
7 | import androidx.annotation.NonNull;
8 | import androidx.annotation.Nullable;
9 | import io.flutter.plugin.common.BasicMessageChannel;
10 | import io.flutter.plugin.common.BinaryMessenger;
11 | import io.flutter.plugin.common.MessageCodec;
12 | import io.flutter.plugin.common.StandardMessageCodec;
13 | import java.io.ByteArrayOutputStream;
14 | import java.nio.ByteBuffer;
15 | import java.util.Arrays;
16 | import java.util.ArrayList;
17 | import java.util.List;
18 | import java.util.Map;
19 | import java.util.HashMap;
20 |
21 | /** Generated class from Pigeon. */
22 | @SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression"})
23 | public class ScreenshotApi {
24 |
25 | public interface Result {
26 | void success(T result);
27 | void error(Throwable error);
28 | }
29 | private static class ScreenshotHostApiCodec extends StandardMessageCodec {
30 | public static final ScreenshotHostApiCodec INSTANCE = new ScreenshotHostApiCodec();
31 | private ScreenshotHostApiCodec() {}
32 | }
33 |
34 | /** Generated interface from Pigeon that represents a handler of messages from Flutter.*/
35 | public interface ScreenshotHostApi {
36 | void takeScreenshot(Result result);
37 | void startListeningScreenshot();
38 | void stopListeningScreenshot();
39 |
40 | /** The codec used by ScreenshotHostApi. */
41 | static MessageCodec