我想我现在至少有一个模糊的想法,
如何在我的应用程序中使用BLoC,Stream Builder
和继承的小部件(或模型)
(没有什么特别的,但对我来说需要时间),
但玩Scoped模型
我有一个存在的危机:
我觉得他们大多数可以做同样的事情,或者
至少我可以
用它们中的任何一个获得相同的明显效果,
但我没有能力去理解
何时 以及为什么一个比另一个好.
我故意保持开放的问题不要因为我而讨厌我,
但我希望能更好地理解我正在做的事情
以及使用这一个或另一个事件在幕后发生的事情.
谢谢你的耐心等待.弗朗切斯科
Ps:我不能添加'范围模型'标签,如果可以的话,
它可能与像我这样的新手有关
我被小部件测试困住了,我可以使用一些帮助
来重现该行为,请运行下面的代码示例
import \'package:flutter/material.dart\';\nimport \'package:hooks_riverpod/hooks_riverpod.dart\';\nimport \'home_page.dart\';\n\nvoid main() => runApp(\n const ProviderScope(\n child: MaterialApp(\n home: Material(\n child: MyHomePage(),\n ),\n ),\n ),\n );\nRun Code Online (Sandbox Code Playgroud)\nimport \'dart:math\';\nimport \'package:flutter/material.dart\';\nimport \'package:flutter_hooks/flutter_hooks.dart\';\nimport \'package:hooks_riverpod/hooks_riverpod.dart\';\n\nextension RoundX on double {\n double roundToPrecision(int n) {\n final f = pow(10, n);\n return (this * f).round() / f;\n }\n}\n\nfinal tasksPod = Provider<List<Future<void> Function()>>(\n (ref) => [\n for (var i = 0; i < 10; ++i)\n () async {\n await Future.delayed(kThemeAnimationDuration);\n }\n ],\n);\n\nfinal progressPod = Provider.autoDispose<ValueNotifier<double>>((ref) {\n final notifier = ValueNotifier<double>(0);\n …Run Code Online (Sandbox Code Playgroud) 卸载latest并安装后nightly,我无法从剪贴板粘贴,请仔细检查我的init.vim是否有set clipboard=unnamedplus
有什么建议吗?
5月21日更新
按照马特的评论,运行:checkhealth provider输出
health#provider#check
========================================================================
## Clipboard (optional)
- WARNING: No clipboard tool found. Clipboard registers (`"+` and `"*`) will not work.
- ADVICE:
- :help clipboard
Run Code Online (Sandbox Code Playgroud)
所以我跑sudo apt-get install -y xclip
并且运行良好(即使使用 Wayland!)
health#provider#check
========================================================================
## Clipboard (optional)
- OK: Clipboard tool found: xclip
Run Code Online (Sandbox Code Playgroud) 是的,好人,
经过几次调试,突然... 日志突然返回我这个错误:
Compiler message:
org-dartlang-debug:synthetic_debug_expression:1:1: Error: Method not found: 'toStringDeep'.
toStringDeep()
^^^^^^^^^^^^
org-dartlang-debug:synthetic_debug_expression:1:1: Error: The method 'toStringDeep' isn't defined for the class 'Logger'.
- 'Logger' is from 'package:logging/logging.dart' ('file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/logging-0.11.3+2/lib/logging.dart').
Run Code Online (Sandbox Code Playgroud)
“ toStringDeep”不是我的东西,可能用于日志记录;我尝试返回步骤并删除已添加的log(?),但仍返回相同的错误。
有什么帮助吗?拜托...
弗朗切斯科
到目前为止,我对 codecov 的设置运行良好
因为我无意中推送了一个不应该推送的文件夹,
然后我合并了一个pr来删除该文件夹
这是我的codecov.yml
_____ _
/ ____| | |
| | ___ __| | ___ ___ _____ __
| | / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| | __/ (_| (_) \ V /
\_____\___/ \__,_|\___|\___\___/ \_/
Bash-1.0.3
==> git version 2.31.1 found
==> curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 …Run Code Online (Sandbox Code Playgroud) 这是我的一段代码,但请在得出结论之前先阅读问题:
class RescheduleCard extends StatelessWidget {
@override
Widget build(BuildContext context)=> Consumer<AppSnapshot>(
builder: (context, appSnapshot, _)=>
(appSnapshot.reschedule!=null)
?RescheduleBuilder(
model: appSnapshot.reschedule,
controllers: appSnapshot.controllers,
)
:Carouselcard(
title: carouselPageTitle(title: rescheduleTitle,test: appSnapshot.test),
colors: yellows,
Run Code Online (Sandbox Code Playgroud)
所以我对提供者有点陌生,我习惯了 Bloc,我的 api 一旦收到一些调用提供者并设置模型;
编辑:这里是提供商 256 条线路,涉及“重新安排”的问题......
class AppSnapshot with ChangeNotifier {
RescheduleModel _reschedule;
RescheduleModel get reschedule => _reschedule;
void cleanReschedule() {
reschedule=null;
notifyListeners();
}
set reschedule(RescheduleModel reschedule) {
_reschedule=reschedule;
notifyListeners();
}
}
Run Code Online (Sandbox Code Playgroud)
重新编辑:最重要的是:
void main() async {
final AppSnapshot _appSnapshot = AppSnapshot();
await _appSnapshot.load();
runApp(ChangeNotifierProvider(
builder: (context) => _appSnapshot,
child: …Run Code Online (Sandbox Code Playgroud) 使用下面的代码
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key key}) : super(key: key);
@override
Widget build(BuildContext context) => MaterialApp(
home: const MyHomePage(),
);
}
class MyHomePage extends StatelessWidget {
const MyHomePage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) => DefaultTabController(
length: 2,
child: Scaffold(
appBar: AppBar(
title: const Center(
child: Text('use the mouse wheel to scroll')),
bottom: TabBar(
tabs: const [
Center(child: Text('ScrollView')),
Center(child: Text('PageView'))
],
),
),
body: TabBarView(
children: [
SingleChildScrollView(
child: …Run Code Online (Sandbox Code Playgroud) mousewheel smooth-scrolling flutter flutter-web flutter-pageview
自上次飞镖更新(2.2)以来,我收到此错误,
'不能将'dynamic' 类型的值分配给'String' 类型的变量。
这对我来说没有多大意义。代码绝对是微不足道的:
class EmployeeMirror {
EmployeeMirror(this.id, this.name);
EmployeeMirror.fromMap(Map<String, dynamic> _map) {
id = _map['id']; // error here
name = _map['name']; // and here
}
int id;
String name;
}
Run Code Online (Sandbox Code Playgroud)
我认为无关紧要,但这是在 Aqueduct 项目中。
在此先感谢您的帮助
flutter ×6
dart ×5
flutter-web ×2
aqueduct ×1
blazor ×1
bloc ×1
c# ×1
codecov ×1
dart2js ×1
dynamic ×1
jwt ×1
logging ×1
mousewheel ×1
neovim ×1
riverpod ×1
scoped-model ×1
string ×1
webassembly ×1