我是 Flutter 新手,刚刚学会了如何在 Dart 中使用隔离。当我尝试通过隔离访问共享首选项时,它会抛出以下给出的错误。当我尝试访问 Firebase 分析和远程配置时,也会出现此错误。如何解决此问题并访问隔离内的 SharedPreference、FirebaseRemote 配置、FirebaseFirestore?
[ERROR:flutter/runtime/dart_isolate.cc(882)] Unhandled exception:
E/flutter (23694): ServicesBinding.defaultBinaryMessenger was accessed before the binding was initialized.
E/flutter (23694): If you're running an application and need to access the binary messenger before `runApp()` has been called (for example, during plugin initialization), then you need to explicitly call the `WidgetsFlutterBinding.ensureInitialized()` first.
E/flutter (23694): If you're running a test, you can call the `TestWidgetsFlutterBinding.ensureInitialized()` as the first line in your test's `main()` method to initialize the binding. …Run Code Online (Sandbox Code Playgroud) 我想从输入'x + y'中删除"+"符号,其中x和y是一个字符串(单个数字)并打印结果.
例如,我输入5 + 7它应该显示57
这是代码:
opr = input("Enter string").strip("+")
print(opr)
Run Code Online (Sandbox Code Playgroud)
此代码未删除"+"符号请帮忙!
如何为单个视图在本地导入样式表。
我有两个视图/home和/blog以下文件目录:
src
?
????components
?
????Home
? Home.js
? Home.css
????Blog
Blog.js
Blog.css
Run Code Online (Sandbox Code Playgroud)
我有一个单独的 css 文件home.css仅用于主页视图,但该样式也应用于博客视图。
我希望home.css文件仅适用于home.js视图。
主页.css
.text1 {
font-size: 1em !important;
font-family: "Noto Sans", sans-serif !important;
color: red;
}
Run Code Online (Sandbox Code Playgroud)
主页.js
import React, { Component } from "react";
import "./home.css";
class Home extends Component {
render() {
return (
<div className="text1" style={{ overflow: "Hidden" }}>
<h1>This must be red.</h1>
<a href="/blog">Go to Blog</a>
</div> …Run Code Online (Sandbox Code Playgroud)