草庐IT

dart-webui

全部标签

dart - 使用 streambuilder 从 firebase 获取数据

我尝试从firebase获取数据,但当我在initState中对其进行初始化时,该函数不起作用。我试着给它debugprint,它没有显示在终端中,当我运行应用程序时没有错误或警告。void_getMarker(){StreamBuilder(stream:Firestore.instance.collection('contentislamis').where('kategori',isEqualTo:'Landmark').snapshots(),builder:(context,snapshot){if(!snapshot.hasData){returnCenter(child:

service - Flutter - Dart 中的后台服务(仅当应用程序可见时)

我需要一个flutter的后台服务,这使得http.get(...)变得非常微小此服务应在应用程序运行时在后台运行。如果应用程序关闭,后台服务也应该停止。当应用启动时,后台服务也应该启动。我只能找到提供后台服务的包,当应用程序关闭时,它也会运行-就像这个例子:https://medium.com/flutter-io/executing-dart-in-the-background-with-flutter-plugins-and-geofencing-2b3e40a1a124也许我要找的不是所谓的“后台服务”?这是一些代码,我想在这个后台服务/任务中运行...Timer.period

service - Flutter - Dart 中的后台服务(仅当应用程序可见时)

我需要一个flutter的后台服务,这使得http.get(...)变得非常微小此服务应在应用程序运行时在后台运行。如果应用程序关闭,后台服务也应该停止。当应用启动时,后台服务也应该启动。我只能找到提供后台服务的包,当应用程序关闭时,它也会运行-就像这个例子:https://medium.com/flutter-io/executing-dart-in-the-background-with-flutter-plugins-and-geofencing-2b3e40a1a124也许我要找的不是所谓的“后台服务”?这是一些代码,我想在这个后台服务/任务中运行...Timer.period

Flutter、Dart 和 Future。这是 Dart Futures 的已知功能并且为空吗?

在下面的代码中(Dart2.4.0Windows),从指示返回类型String的future返回null会导致:I/flutter(8735):ThefollowingassertionwasthrownbuildingBuilder:I/flutter(8735):type'Future'isnotasubtypeoftype'Future'如果我返回“nullasString;”,VSCode会显示警告“unnecessarycast”,但是,代码可以运行,我不会收到fatalerror。有问题的代码如下。我已经注释掉导致问题的行,现在返回“nullasString”。我一直在Da

Flutter、Dart 和 Future。这是 Dart Futures 的已知功能并且为空吗?

在下面的代码中(Dart2.4.0Windows),从指示返回类型String的future返回null会导致:I/flutter(8735):ThefollowingassertionwasthrownbuildingBuilder:I/flutter(8735):type'Future'isnotasubtypeoftype'Future'如果我返回“nullasString;”,VSCode会显示警告“unnecessarycast”,但是,代码可以运行,我不会收到fatalerror。有问题的代码如下。我已经注释掉导致问题的行,现在返回“nullasString”。我一直在Da

flutter - 如何在 Flutter/Dart 中获取系统时间格式(24 或 12 AM/PM)?

如何检测用户手机上设置的当前时间格式(12AM/PM或24小时制)?Android中有一个native方法:DateFormat.is24HourFormat(context);但是,我在Flutter中找不到类似的东西。 最佳答案 boolis24HoursFormat=MediaQuery.of(context).alwaysUse24HourFormat;文档here说:Whethertouse24-hourformatwhenformattingtime.Thebehaviorofthisflagisdifferentacr

flutter - 如何在 Flutter/Dart 中获取系统时间格式(24 或 12 AM/PM)?

如何检测用户手机上设置的当前时间格式(12AM/PM或24小时制)?Android中有一个native方法:DateFormat.is24HourFormat(context);但是,我在Flutter中找不到类似的东西。 最佳答案 boolis24HoursFormat=MediaQuery.of(context).alwaysUse24HourFormat;文档here说:Whethertouse24-hourformatwhenformattingtime.Thebehaviorofthisflagisdifferentacr

dart - 如何同步滚动两个 SingleChildScrollView 小部件

如何同步滚动两个SingleChildScrollView小部件?newPositioned(child:newSingleChildScrollView(scrollDirection:Axis.horizontal,child:newScale()),),newPositioned(child:newSingleChildScrollView(scrollDirection:Axis.horizontal,child:newchart()))我需要这两个小部件具有完全相同的滚动位置(它们具有相同的宽度并且只能水平滚动)。它必须在用户操作后和代码更改时同步。

dart - 如何同步滚动两个 SingleChildScrollView 小部件

如何同步滚动两个SingleChildScrollView小部件?newPositioned(child:newSingleChildScrollView(scrollDirection:Axis.horizontal,child:newScale()),),newPositioned(child:newSingleChildScrollView(scrollDirection:Axis.horizontal,child:newchart()))我需要这两个小部件具有完全相同的滚动位置(它们具有相同的宽度并且只能水平滚动)。它必须在用户操作后和代码更改时同步。

dart - Iterable 的 whereType 方法行为

我无法理解iterable的whereType是如何工作的。我有以下示例,我不知道为什么会这样。有这个代码:Listlist=["SomeString",12];print(list);print(list.whereType());print(list.where((item)=>itemisString));输出是:[SomeString,12](SomeString,12)(SomeString)我希望第二次打印时只有String。有人可以向我解释为什么我错了吗? 最佳答案 我认为这是不一致的,因为whereType是为Dar