如何删除.pub-cache文件夹中的flutter包?当我们给出时flutter clean,它将删除当前目录中的构建文件夹。我们可以手动删除它,但我的要求是.pub-cache使用命令删除文件夹中的包。
我正在参加 MDC101 颤振代码实验室。我按照说明从 git 存储库克隆了启动项目,但是在克隆完成后,我执行了flutter pub get它,但它给了我以下错误。
pubspec.yaml has no lower-bound SDK constraint.
You should edit pubspec.yaml to contain an SDK constraint:
environment:
sdk: '>=2.10.0 <3.0.0'
Run Code Online (Sandbox Code Playgroud) 最近,我的调试控制台显示了以前未显示的内容。当我使用包时会发生这种情况flutter_typeahead。我不知道这是错误还是警告。下面是我的调试控制台:
Launching lib\main.dart on Chrome in debug mode...
: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../Documents/flutter/packages/flutter/lib/src/widgets/binding.dart').
WidgetsBinding.instance!.removeObserver(this);
^
: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../Documents/flutter/packages/flutter/lib/src/widgets/binding.dart').
WidgetsBinding.instance!.addObserver(this);
^
: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../Documents/flutter/packages/flutter/lib/src/widgets/binding.dart').
WidgetsBinding.instance!.addPostFrameCallback((duration) {
^
: Warning: Operand of null-aware operation …Run Code Online (Sandbox Code Playgroud) 升级到 Flutter 3.1.x 后,该包flutter_pinput不再工作。任何的意见都将会有帮助。它在 flutter 2.xx 中工作正常,我尝试使用修复缓存flutter pub cache repair,并使用清理项目缓存flutter clean。它仍然不起作用。
/C:/Users/Administrator/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/pinput-2.2.11/lib/src/pinput_state.dart:334:14: Error: The method 'FocusTrapArea' isn't defined for the class '_PinputState'.\n - '_PinputState' is from 'package:pinput/src/pinput.dart' ('/C:/Users/Administrator/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/pinput-2.2.11/lib/src/pinput.dart').\n Try correcting the name to the name of an existing method, or defining a method named 'FocusTrapArea'.\n child: FocusTrapArea(\n ^^^^^^^^^^^^^\n \n \n FAILURE: Build failed with an exception.\n \n * Where:\n Script 'D:\\flutter\\packages\\flutter_tools\\gradle\\flutter.gradle' line: 1159\n \n * What went wrong:\n Execution failed for task ':app:compileFlutterBuildDebug'.\n …Run Code Online (Sandbox Code Playgroud) 我正在 flutter 中创建一个应用程序,一切都很顺利,但此刻它开始给我一个错误。它不会让我编译,flutter pub升级和flutter pub过时不起作用,但flutter pub get如果工作正常的话。
\n我是颤振新手,我无法理解他们告诉我的大部分内容,如果您能尽可能详细地解释我,我将不胜感激
\nFlutter --no-color 构建 apk\nC:\\src\\flutter\\bin\\flutter.bat --no-color 构建 apk
\n具有良好零安全性的建筑
\nRunning Gradle task 'assembleRelease'...\n/C:/Users/LEO/AppData/Local/Pub/Cache/hosted/pub.dev/google_fonts-2.3.3/lib/src/google_fonts_base.dart:14:1: Error: 'AssetManifest' is imported from both 'package:flutter/src/services/asset_manifest.dart' and 'package:google_fonts/src/asset_manifest.dart'.\nimport 'asset_manifest.dart';\n^^^^^^^^^^^^^\n/C:/Users/LEO/AppData/Local/Pub/Cache/hosted/pub.dev/google_fonts-2.3.3/lib/src/google_fonts_base.dart:32:31: Error: 'AssetManifest' is imported from both 'package:flutter/src/services/asset_manifest.dart' and 'package:google_fonts/src/asset_manifest.dart'.\nAssetManifest assetManifest = AssetManifest();\n^^^^^^^^^^^^^\nTarget kernel_snapshot failed: Exception\n\nFAILURE: Build failed with an exception.\n\nWhere:\nScript 'C:\\src\\flutter\\packages\\flutter_tools\\gradle\\flutter.gradle' line: 1154\n\nWhat went wrong:\nExecution failed for task ':app:compileFlutterBuildRelease'.\n\nProcess 'command 'C:\\src\\flutter\\bin\\flutter.bat'' finished with non-zero exit value 1\n\nTry:\nRun with --stacktrace option to get the stack trace.\nRun with …Run Code Online (Sandbox Code Playgroud) 对于我的场景,我使用 flutter http 包来发出 http 请求...在主屏幕中,我必须发送大约 3 个 http 请求,因为我必须使用等待请求来一一发送。
我已经使用了 BaseAPiService 类,因此所有 API 调用都将通过该类,
如果我在发生上述请求时导航到另一个地方如何破坏该连接?否则,如果导航后应用程序还在等待之前的 API 请求完成。
使用的示例基本 API 服务类
class ApiService {
apiGet(url, data) async {
Get.dialog(LoadingDialog());
var response;
if (data == null) {
response = await http.get(
baseUrl + url,
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
);
}
Navigator.pop(Get.overlayContext);
return response;
}
apiPost(url, data) async {
FocusScopeNode currentFocus = FocusScope.of(Get.context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
Get.dialog(LoadingDialog());
var response;
if (data != null) {
response = await …Run Code Online (Sandbox Code Playgroud) flutter-pub ×6
flutter ×5
dart ×3
dart-pub ×1
flutter-3.0 ×1
flutter-web ×1
http ×1
lower-bound ×1
sdk ×1