Table of Contents
#Introduction to dart:ui’ is not available on this platform :
‘dart:ui‘ is a core Dart library that provides fundamental classes and functions for create and manage user interfaces. known for its versatility and efficiency in building applications across various platforms, including web application, mobile application, and stand alone application for windows.
Error:
Launching lib\main.dart on sdk gphone x86 in debug mode... Invalid depfile: C:\Users\asilswal\repo\SignIn\SignInMobile\signin\.dart_tool\flutter_build\223fbab5937d75386a2faf5f5c64434e\kernel_snapshot.d Invalid depfile: C:\Users\asilswal\repo\SignIn\SignInMobile\signin\.dart_tool\flutter_build\223fbab5937d75386a2faf5f5c64434e\kernel_snapshot.d : Error: Dart library 'dart:ui' is not available on this platform. import 'dart:ui'; ^ Context: The unavailable library 'dart:ui' is imported through these packages: package:signin => dart:ui Detailed import paths for (some of) the these imports: package:signin/main.dart => package:signin/blocs/provider.dart => package:signin/blocs/login_bloc.dart => dart:ui Unhandled exceptio FileSystemException(uri=org-dartlang-untranslatable-uri:dart%3ui; message=StandardFileSystem only supports file:* and data:* URIs) #0 StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:34:7) #1 asFileUri (package:vm/kernel_front_end.dart:654:37) #2 writeDepfile (package:vm/kernel_front_end.dart:794:21) <asynchronous suspension> #3 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:629:9) <asynchronous suspension> #4 starter (package:frontend_server/starter.dart:99:12) <asynchronous suspension> #5 main (file:///C:/b/s/w/ir/x/w/sdk/pkg/frontend_server/bin/frontend_server_starter.dart:13:14) <asynchronous suspension> Target kernel_snapshot failed: Exception FAILURE: Build failed with an exception. * Where: Script 'C:\flutter_windows_2.10.5-stable\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1151 * What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'. > Process 'command 'C:\flutter_windows_2.10.5-stable\flutter\bin\flutter.bat'' finished with non-zero exit value 1 * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 6s Exception: Gradle task assembleDebug failed with exit code 1 Exited (sigterm)
#Common Causes:
- Unsupported Platforms: Certain platforms, such as web or server-side environments, might not support features provided by ‘dart:ui’.
- Misconfiguration: Incorrect configuration or dependencies in your Dart project could lead to this error.
- Version Compatibility: Ensure that your Dart SDK version aligns with the platform requirements. Mismatched versions could trigger compatibility issues.
#Resolving the Error:
- Platform Check: Make sure if the platform you are targeting ‘dart:ui‘. If not, consider alternative approaches or libraries tailored for that platform.
- Dependency Management: check your project dependencies and configurations. Ensure that you’re not inadvertently relying on features incompatible with the platform.
- Version Alignment: check your Dart SDK and platform versions in sync to prevent compatibility conflicts. Updating to the latest versions might resolve certain issues.
- Run command on terminal:
flutter pub cache clean
flutter clean
flutter pub get
flutter run