diff --git a/example/pubspec.lock b/example/pubspec.lock index d75bfe3..f138bfa 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -88,27 +88,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.1" - permission_handler: - dependency: transitive - description: - name: permission_handler - url: "https://pub.dartlang.org" - source: hosted - version: "8.3.0" - permission_handler_platform_interface: - dependency: transitive - description: - name: permission_handler_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "3.7.0" - plugin_platform_interface: - dependency: transitive - description: - name: plugin_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" screenshot_callback: dependency: "direct dev" description: @@ -172,4 +151,4 @@ packages: version: "2.1.2" sdks: dart: ">=2.17.0-0 <3.0.0" - flutter: ">=2.5.0" + flutter: ">=2.2.0" diff --git a/lib/screenshot_callback.dart b/lib/screenshot_callback.dart index c719c2a..dabbc38 100644 --- a/lib/screenshot_callback.dart +++ b/lib/screenshot_callback.dart @@ -1,9 +1,7 @@ -import 'dart:io'; import 'dart:async'; import 'package:flutter/scheduler.dart'; import 'package:flutter/services.dart'; -import 'package:permission_handler/permission_handler.dart'; class ScreenshotCallback { static const MethodChannel _channel = @@ -12,23 +10,12 @@ class ScreenshotCallback { /// Functions to execute when callback fired. List onCallbacks = []; - /// If `true`, the user will be asked to grant storage permissions when - /// callback is added. - /// - /// Defaults to `true`. - bool requestPermissions; - - ScreenshotCallback({ - this.requestPermissions = true, - }) { + ScreenshotCallback() { initialize(); } /// Initializes screenshot callback plugin. Future initialize() async { - if (Platform.isAndroid && requestPermissions) { - await checkPermission(); - } _channel.setMethodCallHandler(_handleMethod); await _channel.invokeMethod('initialize'); } @@ -52,9 +39,4 @@ class ScreenshotCallback { /// Remove callback listener. Future dispose() async => await _channel.invokeMethod('dispose'); - - /// Checks if user has granted permissions for storage. - /// - /// If permission is not granted, it'll be requested. - Future checkPermission() async => await Permission.storage.request(); } diff --git a/pubspec.lock b/pubspec.lock index 872560d..a461bdf 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -88,27 +88,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.1" - permission_handler: - dependency: "direct main" - description: - name: permission_handler - url: "https://pub.dartlang.org" - source: hosted - version: "8.3.0" - permission_handler_platform_interface: - dependency: transitive - description: - name: permission_handler_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "3.7.0" - plugin_platform_interface: - dependency: transitive - description: - name: plugin_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" sky_engine: dependency: transitive description: flutter @@ -165,4 +144,4 @@ packages: version: "2.1.2" sdks: dart: ">=2.17.0-0 <3.0.0" - flutter: ">=2.5.0" + flutter: ">=2.2.0" diff --git a/pubspec.yaml b/pubspec.yaml index 12491fd..7564b96 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -10,7 +10,6 @@ environment: dependencies: flutter: sdk: flutter - permission_handler: ^8.1.2 dev_dependencies: flutter_test: