Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File file = File(path); not work by uses universal_io but work by uses dart:io. What I should do? #20

Open
SittiphanSittisak opened this issue Apr 11, 2021 · 6 comments

Comments

@SittiphanSittisak
Copy link

flutter doctor

[√] Flutter (Channel stable, 2.0.4, on Microsoft Windows [Version 10.0.19042.906], locale en-US)
• Flutter version 2.0.4 at C:\flutter
• Framework revision b1395592de (10 days ago), 2021-04-01 14:25:01 -0700
• Engine revision 2dce47073a
• Dart version 2.12.2

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\sitti\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 1.8.0_242-release-1644-b01)
• All Android licenses accepted.

[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 4.1.0)
• 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 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.55.0)
• VS Code at C:\Users\sitti\AppData\Local\Programs\Microsoft VS Code
• Flutter extension can be installed from:
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[√] Connected device (2 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.114
• Edge (web) • edge • web-javascript • Microsoft Edge 89.0.774.75

• No issues found!

@SittiphanSittisak SittiphanSittisak changed the title File file = File(path); not work by uses universal_io but work by uses dart:io. What I should to do? File file = File(path); not work by uses universal_io but work by uses dart:io. What I should do? Apr 11, 2021
@Desync-o-tron
Copy link

perhaps something like
import <this_lib> as U_IO
//then use File from that like
U_IO.File(...)

@IoanSolovastru97
Copy link

Same problem here, using universal_io: 2.0.4
Error:
`Error: UnimplementedError
at Object.throw_ [as throw] (http://localhost:54985/dart_sdk.js:5041:11)
at Function.new (http://localhost:54985/packages/universal_io/src/io/sync_socket.dart.lib.js:3413:19)
at launchResume (http://localhost:54985/packages/my_resume/business/resume.dart.lib.js:19:35)
at launchResume.next ()
at runBody (http://localhost:54985/dart_sdk.js:37422:34)
at Object._async [as async] (http://localhost:54985/dart_sdk.js:37453:7)
at Object.launchResume (http://localhost:54985/packages/my_resume/business/resume.dart.lib.js:18:18)
at http://localhost:54985/packages/my_resume/components/side_menu.dart.lib.js:501:24
at ink_well._InkResponseState.new.[_handleTap] (http://localhost:54985/packages/flutter/src/material/icon_button.dart.lib.js:48455:31)
at tap.TapGestureRecognizer.new.invokeCallback (http://localhost:54985/packages/flutter/src/gestures/recognizer.dart.lib.js:183:18)
at tap.TapGestureRecognizer.new.handleTapUp (http://localhost:54985/packages/flutter/src/gestures/tap.dart.lib.js:393:40)
at tap.TapGestureRecognizer.new.[_checkUp] (http://localhost:54985/packages/flutter/src/gestures/tap.dart.lib.js:205:12)
at tap.TapGestureRecognizer.new.handlePrimaryPointer (http://localhost:54985/packages/flutter/src/gestures/tap.dart.lib.js:154:23)
at tap.TapGestureRecognizer.new.handleEvent (http://localhost:54985/packages/flutter/src/gestures/recognizer.dart.lib.js:423:16)
at pointer_router.PointerRouter.new.[_dispatch] (http://localhost:54985/packages/flutter/src/gestures/pointer_router.dart.lib.js:85:9)
at http://localhost:54985/packages/flutter/src/gestures/pointer_router.dart.lib.js:115:26
at LinkedMap.new.forEach (http://localhost:54985/dart_sdk.js:25250:11)
at pointer_router.PointerRouter.new.[_dispatchEventToRoutes] (http://localhost:54985/packages/flutter/src/gestures/pointer_router.dart.lib.js:113:29)
at pointer_router.PointerRouter.new.route (http://localhost:54985/packages/flutter/src/gestures/pointer_router.dart.lib.js:108:37)
at binding$5.WidgetsFlutterBinding.new.handleEvent (http://localhost:54985/packages/flutter/src/gestures/binding.dart.lib.js:362:26)

`

@a-wallen
Copy link

Hi I am trying to use universal_io so that I can use open_file on web. When I try to create a new file using the same procedure as other people in this thread I am getting the same unimplemented error.

@Ldev007
Copy link

Ldev007 commented Jan 20, 2022

After some debugging I found the following thing to be going wrong @terrier989

@pragma('vm:entry-point')
factory File(String path) {
final overrides = IOOverrides.current;
if (overrides == null) {
throw UnimplementedError();
}
return overrides.createFile(path);
}

Line no : 221-228
File name : lib/src/io/file.dart

Within this code block overrides variable is becoming null which is causing this unimplementedError to be thrown.

@naveenbharadwaj19
Copy link

Any update ? i'm facing same Error: UnimplementedError

@ekuleshov
Copy link

The main issue is that File(path) and Directory(path) APIs aren't implemented on web.

terrier989 it would be great to have some example or guidelines how those could be supported on the web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants