每当我尝试安装任何依赖项时,我都会在日志中收到以下错误pubspec.yaml
Building with plugins requires symlink support.
Please enable Developer Mode in your system settings. Run
start ms-settings:developers
to open settings.
exit code 1
Run Code Online (Sandbox Code Playgroud)
在lib
文件夹中,有一个名为的文件generated_plugin_registrant.dart
也显示错误,可能链接到上面的日志错误。
//
// Generated file. Do not edit.
//
// ignore_for_file: lines_longer_than_80_chars
import 'package:firebase_core_web/firebase_core_web.dart';
import 'package:printing/src/printing_web.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
// ignore: public_member_api_docs
void registerPlugins(Registrar registrar) {
FirebaseCoreWeb.registerWith(registrar);
PrintingPlugin.registerWith(registrar);
registrar.registerMessageHandler();
}
Run Code Online (Sandbox Code Playgroud) 在Firebase中,ref
并且child
使用了很多.
例如 - 它的firebase.database().ref('users/<user-id>')
工作方式完全相同firebase.database().ref('users').child('<user-id>')
,那么它们之间的区别究竟是什么?它们应该何时使用?
我正在尝试创建一个简单的程序,从用户获取名称,手机号码和电子邮件地址,然后将数据放在Firebase实时数据库上.
有3个输入框和一个点击按钮进行上述操作的按钮.这是代码:
<input type="text" id="name">
<input type="text" id="mobile">
<input type="text" id="email">
<button type="button" id="button" onclick="addLead()">Submit</button>
Run Code Online (Sandbox Code Playgroud)
我已经像这样设置了Firebase:
<script src="https://www.gstatic.com/firebasejs/3.2.0/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
...
};
firebase.initializeApp(config);
var database = firebase.database();
</script>
Run Code Online (Sandbox Code Playgroud)
这是我的addLead()
功能:
function addLead() {
var clientName = document.getElementById('name').value;
var clientMobile = document.getElementById('mobile').value;
var clientEmail = document.getElementById('email').value;
var newClientKey = database.ref().child('leads').push().key;
database.ref('leads/'+newClientKey+'/name').set(clientName);
database.ref('leads/'+newClientKey+'/mobile').set(clientMobile);
database.ref('leads/'+newClientKey+'/email').set(clientEmail);
}
Run Code Online (Sandbox Code Playgroud)
这就是我将数据放到数据库中的方法.
所以newClientKey
生成一些字符串,插入时效果很好但现在如何检索?该官方文档是没有帮助的.这个生成的字符串可能基于时间戳,如果是这种情况,则再次生成它是不可能的.
检索如何在插入时才能访问的唯一生成的字符串下,如何访问电子邮件,移动设备和名称?
按照上面的结构,我需要降低2级才能访问所需的数据,由于缺少文档,我不知道该怎么做,我不确定这样的东西是否会起作用:
database.child().child();
Run Code Online (Sandbox Code Playgroud) 我在Main Activity中放置了一个switch小部件,我还有第二个扩展BroadcastReceiver的活动.我想在第二个活动中获得switch小部件的布尔状态.
如果我输入
Switch s = (Switch) findViewById(R.id.switch1);
Run Code Online (Sandbox Code Playgroud)
它表示对于SecondActivity类型未定义findViewById.问题是Android不允许我在扩展Broadcast Receiver的类中获得switch的值.
我想知道开关的状态,即开关是打开还是关闭,但是在第二个活动中.我怎样才能实现它?
我有一个WelcomeScreen
包含注册和登录以及HomeScreen
我想在用户登录后重定向的位置。为了管理身份验证数据,我创建了一个auth.dart
带有static
属性和方法的属性和方法,以便我可以使用相同的数据跨所有页面访问它们。
import 'package:firebase_auth/firebase_auth.dart';
class Auth {
static final auth = FirebaseAuth.instance;
static Future<void> logout() async {
await auth.signOut();
}
static Future<void> loginUser(String userEmail, String userPassword) async {
await auth.signInWithEmailAndPassword(email: userEmail, password: userPassword);
}
static Future<FirebaseUser> getCurrentUser() async {
return await auth.currentUser();
}
}
Run Code Online (Sandbox Code Playgroud)
在main.dart
文件中,我使用StreamBuilder
基于更改身份验证数据来更改当前屏幕。我StreamBuilder
从这个答案中得到了这个代码。
home: StreamBuilder<FirebaseUser>(
stream: Auth.auth.onAuthStateChanged,
builder: (context, snapshot) {
if (snapshot.hasData) {
return HomeScreen();
} else {
return WelcomeScreen();
}
}, …
Run Code Online (Sandbox Code Playgroud) 我有多个列表图块,我想向选定的列表图块添加一些样式。为了设置所选图块的颜色,我使用了ListTileTheme
因此无论选择哪个图块都将获得 中定义的颜色ListTileTheme
。
ListTileTheme(
selectedTileColor: Colors.white,
child: ...
),
Run Code Online (Sandbox Code Playgroud)
我还想在 的左上角和左下角设置边框半径ListTile
,为此我正在使用ClipRRect
ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(32),
bottomLeft: Radius.circular(32),
),
child: ListTile(
leading: Icon(Icons.people),
title: Text('Teams'),
onTap: () {},
selected: true,
),
),
Run Code Online (Sandbox Code Playgroud)
如下图所示,效果很好:
但我必须手动将其添加到特定的列表图块中。与定义一次的所选图块颜色不同,它会自动应用到所选属性为 true 的任何图块上,如何ClipRRect
以类似的方式进行设置,以便选择的图块在左上角和左下角接收边框半径?
我正在尝试处理我的 flutter 应用程序中的动态链接,并且当应用程序已安装时它们可以完美工作。无论应用程序在后台打开还是关闭,该链接都可以正常工作。但是,当我在未安装应用程序时尝试使用链接时,我会正确地进入应用程序商店,但是一旦我在安装完成后从应用程序商店中打开应用程序,它只会打开应用程序,而我的动态链接功能永远不会执行。
我的动态链接类似于:
https: //startingxi.page.link/? link=https://url-redacted/game/gameId&apn=myapn&isi=mysi&ibi=myibi&st=new%20team%20vs%20&sd=1%20 -%202&efr=1
我已经尝试过使用efr=1
和不使用它。
我的颤振代码:
@override
void initState() {
super.initState();
initDynamicLinks();
futureInitState = initStateAsync();
}
Future<void> initDynamicLinks() async {
final PendingDynamicLinkData data = await FirebaseDynamicLinks.instance.getInitialLink();
final Uri deepLink = data?.link;
await processDeepLink(deepLink);
FirebaseDynamicLinks.instance.onLink(onSuccess: (PendingDynamicLinkData dynamicLink) async {
final Uri deepLink = dynamicLink?.link;
await processDeepLink(deepLink);
}, onError: (OnLinkErrorException e) async {
print('onLinkError');
print(e.message);
displayFlushBar('$e.message');
});
}
Run Code Online (Sandbox Code Playgroud)
我尝试将其放入initDynamicLinks
my 中futureInitState
,它是 my 的一部分FutureBuilder
,它在启动时执行其他异步操作。任何帮助,将不胜感激。我不知道如何调试这个问题,这是我第一次 ios/app 开发经验,所以我不确定 ios 设备上是否有一些日志可能有帮助?但目前看来,我需要部署到生产环境并在应用程序商店中发布我的更改,然后才能测试任何内容,这似乎不太理想。但由于动态链接适用于其他用例,我在故障排除方面遇到了困难。
谢谢!
我想使用更改状态栏的颜色,我从这个答案AnnotatedRegion
中得到了以下代码,但它对状态栏颜色没有影响。
AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle.light.copyWith(statusBarColor: Colors.white),
child: Scaffold(
appBar: AppBar(
title: Text('Annotated Region'),
),
body: Center(
child:
Text('Status Bar!'),
),
),
)
Run Code Online (Sandbox Code Playgroud)
要快速开始使用此代码,您可以使用此 Github 存储库。
MyApp
构造函数中出现错误
const MyApp({Key? key}) : super(key: key);
Run Code Online (Sandbox Code Playgroud)
这需要启用“不可为空”语言功能。尝试更新 pubspec.yaml 将最低 SDK 限制设置为 2.12.0 或更高版本,然后运行“pub get”。
但sdk默认设置为2.12.0
sdk: ">=2.12.0 <3.0.0"
Run Code Online (Sandbox Code Playgroud)
该项目是使用最新版本的 Flutter 和 Dart 创建的。
飞镖版本:2.13.3
颤动版本:2.2.2
上周,我创建了一个应用程序,并通过在Android Studio中创建密钥库将其第一个版本上载到Play Store。我想注册App Signing,但Play Console说我首先需要上传应用程序,然后才能注册,所以我上传了应用程序捆绑包(app.aab),然后注册了程序,现在我可以看到2个证书-上传证书和应用签名证书。可以选择以.der格式下载它们。
这些.der文件怎么办?要发布更新,我再次转到Generate Signed Build,它询问我选择并输入密码的密钥库,并生成了更新的签名应用程序捆绑包。
在整个过程中,我从来没有遇到过使用.der证书的选项,如果不需要,为什么它们会显示在Play控制台的“发行管理”下的“应用签名”中。而且,由于Android Studio仍基于硬盘上可用的密钥存储区生成签名版本,因此我注册的应用程序签名有什么意义?
有关应用程序签名和管理密钥的官方文档甚至没有提及这些上传证书。它所提及的只是使用上传密钥对您的应用进行签名,什么是上传密钥-Play控制台未提及它,Android Studio和Android Studio也不要求密钥库生成.jks格式的签名版本