我正在开发我的 flutter 应用程序,但在运行项目时,此消息显示在终端中:
Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\google_sign_in-5.2.3\android\src\main\java\io\flutter\plugins\googlesignin\GoogleSignInPlugin.
java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Run Code Online (Sandbox Code Playgroud) 我正在编写一个扩展,需要通过多部分表单数据上传选定的文件。
我找到了一些片段,例如Cannot POST a multipart/form-data using Fetch TYPESCRIPT,并写了类似的内容:
window.showOpenDialog({
canSelectFiles: true,
canSelectFolders: false,
canSelectMany: false,
filters: {
'image': ['jpg', 'png'],
},
title: 'Add Image',
}).then(async uriList => {
if (undefined === uriList || uriList.length === 0) {
return;
}
let imageFile = createReadStream(uriList[0].fsPath);
let formData = new FormData();
formData.append('file', imageFile); // <- ts(2345) error
});
Run Code Online (Sandbox Code Playgroud)
然而它抱怨:
Argument of type 'ReadStream' is not assignable to parameter of type 'string | Blob'.
Type 'ReadStream' is missing the following properties from …Run Code Online (Sandbox Code Playgroud) multipartform-data typescript visual-studio-code vscode-extensions
我的问题:Ctrl + Y删除代码行而不是重做
我一直看到与此问题类似的问题,但没有答案。
keyboard-shortcuts key-bindings undo-redo visual-studio-code
我是 flutter 的新手\n我有这个大小的配置文件,我在一个旧项目中使用了它\n现在我再次将它带到另一个项目中,它没有显示任何错误,但当我运行时它给了我一个异常:\n\xe2 \x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90 小部件捕获的异常库 \xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\ xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\ x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\ x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\ xe2\x95\x90\xe2\x95\x90\n构建主体(脏)时抛出以下 LateError:\nLateInitializationError:字段“screenWidth”尚未初始化。
\nimport 'package:flutter/material.dart';\n\n\nclass SizeConfig {\n static late MediaQueryData _mediaQueryData;\n static late double screenWidth;\n static late double screenHeight;\n static double? defaultSize;\n static Orientation? orientation;\n void init(BuildContext context) {\n _mediaQueryData = MediaQuery.of(context);\n screenWidth = _mediaQueryData.size.width;\n screenHeight = _mediaQueryData.size.height;\n orientation = _mediaQueryData.orientation;\n }\n}\n// Get the proportionate height as per screen size\ndouble getProportionateScreenHeight(double inputHeight) {\n double screenHeight = SizeConfig.screenHeight;\n // 812 is the layout height that designer use\n return (inputHeight / 812.0) * …Run Code Online (Sandbox Code Playgroud) 主要.cpp:
#include <iostream>
#include "Person.hpp"
int main()
{
std::cout << "HELL!\n";
Person a{"Jiraya"};
std::cout << a.getName() << "\n";
a.setName("Niko");
a.do_smt();
}
Run Code Online (Sandbox Code Playgroud)
人.hpp:
#pragma once
#include <string>
using std::string;
class Person
{
private:
string name;
public:
Person();
Person(const string &n);
void do_smt();
string getName(){return name;}
void setName(const string& n);
Run Code Online (Sandbox Code Playgroud)
人.cpp:
#pragma once
#include <iostream>
#include "Person.hpp"
Person::Person(const string &n) : name{n}
{
}
void Person::setName(const string &n)
{
name = n;
} …Run Code Online (Sandbox Code Playgroud) 有没有一种方法可以指定函数将返回特定类型的对象,其中类型是参数之一的字符串?
例如
/**
* @return object<$class>
*/
public function create(string $class): object {
... some factory stuff
}
Run Code Online (Sandbox Code Playgroud)
这样 vscode 或 phpstorm 就会知道当我这样做时
$myvar = X::create('MyClass');
Run Code Online (Sandbox Code Playgroud)
$myvar 将是 MyClass 类型,我将拥有适当的智能感知/自动完成功能?
我发现自己经常想用console.log(...). 例如,如果我有以下代码:
let myVar = "Hello";
myVar.slice(1,3);| // '|' means where the cursor is after typing in the last line
Run Code Online (Sandbox Code Playgroud)
从那里我想将该行包装在 a 中,console.log这样它就变成:
let myVar = "Hello";
console.log(myVar.slice(1,3));
Run Code Online (Sandbox Code Playgroud)
我可以在 VS Code 中创建一个快捷方式来执行此操作吗?我有一个扩展应该可以做到这一点,但 80% 的情况下它会出错(例如将 放在 the)后面;,所以我只想执行一个总是正确的快捷命令,而不必安装扩展程序。我该怎么做?
我的根文件夹中有很多文件,我希望能够轻松地确定当前文件在 VScode Explorer 侧栏中的位置。
“文件:在侧栏中显示活动文件”命令几乎就是我所需要的:它打开资源管理器侧栏并用蓝色框突出显示当前根文件夹。然而,整个根文件夹被突出显示,而不是特定的文件,所以我仍然必须在该树中的所有其他子目录和文件中寻找它。
是否有一个或一组命令可以用来实现此目的?或者,是否有一个我可以更改的设置,使活动文件始终在侧边栏中突出显示?我只是想要某种指示器来准确查看我的活动文件在树中的位置。
我喜欢在每个子组件及其组件的单独行中进行编程,在遇到一些问题后,我最近从 Android Studio 迁移到 VS Code,但我注意到在 VS Code 中,保存文件 (CTRL+S) 或重新启动 IDE,它会自动将代码缩小到一行,这非常令人沮丧,我该如何解决这个问题?
保存前

保存后

dart ×4
flutter ×4
android ×1
c++ ×1
dart-pub ×1
exception ×1
g++ ×1
javascript ×1
key-bindings ×1
php ×1
phpstan ×1
psalm-php ×1
typescript ×1
undo-redo ×1