flutter-plugins
flutter-plugins copied to clipboard
[Web] offset != null
Flutter Web: If you put a file on the drag zone, an error occurs as shown below.
Error
_handleMethodChannel: Assertion failed: file:///Users/patrick386/.pub-cache/hosted/pub.dartlang.org/desktop_drop-0.3.3/lib/src/channel.dart:96:16
_offset != null
is not true dart-sdk/lib/internal/js_dev_runtime/private/ddc_runtime/errors.dart 251:49 throw
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 29:3 assertFailed
packages/desktop_drop/src/channel.dart 96:24 _handleMethodChannel
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5 _async
packages/desktop_drop/src/channel.dart 40:36 [_handleMethodChannel]
packages/desktop_drop/src/channel.dart 33:22
Flutter doctor -v
[✓] Flutter (Channel stable, 3.0.0, on macOS 12.4 21F79 darwin-arm, locale ko-KR) • Flutter version 3.0.0 at /Users/patrick386/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision ee4e09cce0 (2 weeks ago), 2022-05-09 16:45:18 -0700 • Engine revision d1b9a6938a • Dart version 2.17.0 • DevTools version 2.12.2
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) • Android SDK at /Users/patrick386/Library/Android/sdk • Platform android-32, build-tools 32.1.0-rc1 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763) • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.3) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.3
[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
[✓] Connected device (2 available) • macOS (desktop) • macos • darwin-arm64 • macOS 12.4 21F79 darwin-arm • Chrome (web) • chrome • web-javascript • Google Chrome 101.0.4951.64
[✓] HTTP Host Availability • All required HTTP hosts are available
• No issues found!
Can you give some sample code which could reproduce this issue?
I tested desktop_drop example with flutter 3.0.1 , but it seems work fine.
I don't know what I did wrong. Here is the sample code.
Sample code
import 'package:desktop_drop/desktop_drop.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(child: _DropTest()),
// This trailing comma makes auto-formatting nicer for build methods.
);
}
}
class _DropTest extends StatefulWidget {
const _DropTest({Key? key}) : super(key: key);
@override
State<_DropTest> createState() => _DropTestState();
}
class _DropTestState extends State<_DropTest> {
@override
Widget build(BuildContext context) {
return DropTarget(
onDragDone: (DropDoneDetails detail) async {
print('Detail:${detail.files.first.name}');
},
onDragUpdated: (DropEventDetails details) {
},
onDragEntered: (DropEventDetails detail) {
},
onDragExited: (DropEventDetails detail) {
},
child:Container(
width: 600,
height: 60,
color: Colors.amber,
alignment: Alignment.center,
child: const Text('Attach files by dragging & dropping, selecting them.'),
),
);
}
}
Error
Performing hot restart...
Waiting for connection from debug service on Chrome...
Restarted application in 178ms.
_handleMethodChannel: Assertion failed: file:///C:/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/desktop_drop-0.3.3/lib/src/channel.dart:43:16
_offset == null
is not true C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 251:49 throw_
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 29:3 assertFailed
packages/desktop_drop/src/channel.dart 43:24 _handleMethodChannel
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5 _async
packages/desktop_drop/src/channel.dart 40:36 [_handleMethodChannel]
packages/desktop_drop/src/channel.dart 33:22 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5 _async
packages/desktop_drop/src/channel.dart 31:36 <fn>
packages/flutter/src/services/platform_channel.dart 404:55 _handleAsMethodCall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5 _async
packages/flutter/src/services/platform_channel.dart 401:40 [_handleAsMethodCall]
packages/flutter/src/services/platform_channel.dart 397:34 <fn>
packages/flutter/src/services/binding.dart 380:35 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5 _async
packages/flutter/src/services/binding.dart 377:98 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine/platform_dispatcher.dart 1121:13 invoke2
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/ui/channel_buffers.dart 25:12 invoke
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/ui/channel_buffers.dart 65:7 push
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/ui/channel_buffers.dart 130:16 push
packages/flutter_web_plugins/src/plugin_registry.dart 144:23 send
packages/flutter/src/services/platform_channel.dart 157:52 _invokeMethod
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5 _async
packages/flutter/src/services/platform_channel.dart 155:30 [_invokeMethod]
packages/flutter/src/services/platform_channel.dart 340:12 invokeMethod
packages/desktop_drop/desktop_drop_web.dart 64:15 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 334:14 _checkAndCall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 339:39 dcall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/html/dart2js/html_dart2js.dart 37285:58 <fn>
Detail:2021.04.12_Invoice.PDF
_handleMethodChannel: Assertion failed: file:///C:/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/desktop_drop-0.3.3/lib/src/channel.dart:96:16
_offset != null
is not true C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 251:49 throw_
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 29:3 assertFailed
packages/desktop_drop/src/channel.dart 96:24 _handleMethodChannel
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5 _async
packages/desktop_drop/src/channel.dart 40:36 [_handleMethodChannel]
packages/desktop_drop/src/channel.dart 33:22 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5 _async
packages/desktop_drop/src/channel.dart 31:36 <fn>
packages/flutter/src/services/platform_channel.dart 404:55 _handleAsMethodCall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5 _async
packages/flutter/src/services/platform_channel.dart 401:40 [_handleAsMethodCall]
packages/flutter/src/services/platform_channel.dart 397:34 <fn>
packages/flutter/src/services/binding.dart 380:35 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5 _async
packages/flutter/src/services/binding.dart 377:98 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine/platform_dispatcher.dart 1121:13 invoke2
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/ui/channel_buffers.dart 25:12 invoke
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/ui/channel_buffers.dart 65:7 push
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/ui/channel_buffers.dart 130:16 push
packages/flutter_web_plugins/src/plugin_registry.dart 144:23 send
packages/flutter/src/services/platform_channel.dart 157:52 _invokeMethod
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5 _async
packages/flutter/src/services/platform_channel.dart 155:30 [_invokeMethod]
packages/flutter/src/services/platform_channel.dart 340:12 invokeMethod
packages/desktop_drop/desktop_drop_web.dart 55:17 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 334:14 _checkAndCall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 339:39 dcall
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/html/dart2js/html_dart2js.dart 37285:58 <fn>
[√] Flutter (Channel stable, 3.0.1, on Microsoft Windows [Version 10.0.19044.1706], locale ko-KR)
• Flutter version 3.0.1 at C:\Dev\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision fb57da5f94 (2 weeks ago), 2022-05-19 15:50:29 -0700
• Engine revision caaafc5604
• Dart version 2.17.1
• DevTools version 2.12.2
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\SintPatrick\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.3)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.1.32328.378
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2021.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
[√] VS Code (version 1.52.1)
• VS Code at C:\Users\SintPatrick\AppData\Local\Programs\Microsoft VS Code
• Flutter extension can be installed from:
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.1706]
• Chrome (web) • chrome • web-javascript • Google Chrome 102.0.5005.63
• Edge (web) • edge • web-javascript • Microsoft Edge 101.0.1210.53
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
I have the same issue too, any update about it?
Submitted this pull request 251c4bb9e4ed6c5e754502e205b6286f7b08077d to resolve the issue...
I forgot about this because of other tasks. At that time, I had tested this sufficiently. My guess is that this issue appears to be caused by overlapping drop areas. Testing with a Stack widget can indeed be helpful in identifying the problem.
https://firebasestorage.googleapis.com/v0/b/pronto-386.appspot.com/o/%E1%84%92%E1%85%AA%E1%84%86%E1%85%A7%E1%86%AB%20%E1%84%80%E1%85%B5%E1%84%85%E1%85%A9%E1%86%A8%202022-11-14%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%208.25.00.mov?alt=media&token=ed8c8037-c6db-4ef7-920c-11de0d8fd00e
Test sample: https://github.com/Patrick386/flutter_dropzone_web.git
in my case error occurs when I hot reload the web app
in my case error occurs when I hot reload the web app
Same here, it throws error only after reloading.