小编Blo*_*oss的帖子

如何从摩尔中删除所有内容?

我试图在注销时删除所有内容。

onPressed: () {
       _categoryBloc.deleteEntry();
 }
Run Code Online (Sandbox Code Playgroud)

但是错误来了

未处理的异常:NoSuchMethodError:在 null 上调用了方法“deleteEntry”。E/flutter(9255):接收器:null E/flutter(9255):尝试调用:deleteEntry()

初始集团

 CategoryBloc _categoryBloc;
Run Code Online (Sandbox Code Playgroud)

MyBloc 类

class CategoryBloc {
...
      void deleteEntry() {
        _categoryRepository.deleteCategory();
      }
...
}
Run Code Online (Sandbox Code Playgroud)

我的回购课程

deleteCategory() async {
    try{
      await _categoryDao.deleteEntry();
    }catch (e){
      print('Caught in delete ${e.body}');
      rethrow;
    }
  }
Run Code Online (Sandbox Code Playgroud)

道课

  Future deleteEntry() {
    return delete(categories).delete(Categorie());
  }
Run Code Online (Sandbox Code Playgroud)

数据类

class Categorie extends DataClass implements Insertable<Categorie> {
  final String id;
  final bool isActive;
  final String categoryName;
  final int displayOrder;
  Categorie(
      {@required this.id,
      @required this.isActive,
      @required this.categoryName,
      @required this.displayOrder});
  factory …
Run Code Online (Sandbox Code Playgroud)

dart flutter

3
推荐指数
1
解决办法
2087
查看次数

Flutter:在 pubspec.yaml 中设置包版本的约束

我使用了共享包,共享包文档说这样添加,

\n\n
 share: ">=0.6.y+x <2.0.0"\n
Run Code Online (Sandbox Code Playgroud)\n\n

请设置共享约束:\'>=0.6.y+x <2.0.0\'

\n\n

运行 pub get 后,我​​收到此错误,

\n\n
Error on line 65, column 10 of pubspec.yaml: Invalid version constraint: Expected version number after ">=" in ">=0.6.y+x <2.0.0", got "0.6.y+x <2.0.0".\n\n   \xe2\x95\xb7\n\n65 \xe2\x94\x82   share: ">=0.6.y+x <2.0.0"\n\n   \xe2\x94\x82          ^^^^^^^^^^^^^^^^^^\n\n   \xe2\x95\xb5\npub get failed (65;    \xe2\x95\xb5)\n
Run Code Online (Sandbox Code Playgroud)\n

dart flutter

3
推荐指数
1
解决办法
1477
查看次数

how to open bottomSheet after navigate on the page without using onPressed flutter?

Is it possible to open bottomSheet after navigate the page without using onPressed?

Currently, I added to open bottomSheet on onPressed event

scaffoldKey.currentState
        .showBottomSheet((context) => Container(
              height: 100,
              color: Colors.red,
)),                                                                                      
Run Code Online (Sandbox Code Playgroud)

dart flutter flutter-layout

2
推荐指数
1
解决办法
1598
查看次数

Firebase 功能错误:默认 Firebase 应用不存在

以前,该功能有效。但我添加了一些代码,现在这个错误来了。如何解决这个问题?

Error: Error occurred while parsing your function triggers.

Error: The default Firebase app does not exist. Make sure you call initializeApp() before using any of the Firebase services.
    at FirebaseAppError.FirebaseError [as constructor] (/Users/demo/functions/node_modules/firebase-admin/lib/utils/error.js:42:28)
Run Code Online (Sandbox Code Playgroud)

代码

import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
import { getLocations, getLocationsByType } from '../service/locationQuery/locationQuery';

//I tried both way, but same error came
// admin.initializeApp(functions.config().firebase);
admin.initializeApp();
exports.findUsers = functions.https.onCall(async (data: any, context: any) => {
Run Code Online (Sandbox Code Playgroud)

node.js firebase google-cloud-functions

2
推荐指数
1
解决办法
5269
查看次数

typescript 接口变量 null 检查并设置默认值

如何检查接口变量上的 null 以及如何在打字稿中设置默认值?

const userModel = snap.data() as UserModel //firestore

export interface UserModel {
    docId: string, 
    accountId: number // if null then I want to set 0
}
Run Code Online (Sandbox Code Playgroud)

有时,用户没有帐户 ID。那么我该如何检查呢?

if (userModel.userPushToken !== undefined)- 目前我正在这样检查

firebase typescript google-cloud-functions

2
推荐指数
1
解决办法
8869
查看次数

使用 {react-select} 时无法读取未定义的属性“名称”

我很开始reactJS和前端

我为我的下拉菜单添加了 react-select npm,如下所示,在添加 react-select 之前,一切正常。如何在Select中定义名称?

<div className="container">
            <div className="row">
              <div className="col-md-4" />
              <div className="col-md-4">
                <Select
                  options={this.state.allGenres}
                  onChange={this.props.onDataChange}
                  name="genre"
                />
              </div>
              <div className="col-md-4" />
            </div>
          </div>
Run Code Online (Sandbox Code Playgroud)

这是我的数组,

 var Data = response.data;
    const map = Data.map((arrElement, index) => ({
      label: arrElement,
      value: index
    }));
Run Code Online (Sandbox Code Playgroud)

例子:

[
    {
        "label": "Action",
        "value": 0
    },
    {
        "label": "Comedy",
        "value": 1
    },
    {
        "label": "Documentary",
        "value": 2
    }
]
Run Code Online (Sandbox Code Playgroud)

错误信息进来这里,

   dataChange(ev, action) {
    this.setState({
      [ev.target.name]: ev.target.value
    });
  }
Run Code Online (Sandbox Code Playgroud)

使成为()

 render() {
    return (
      <Movie …
Run Code Online (Sandbox Code Playgroud)

reactjs react-select

1
推荐指数
1
解决办法
4162
查看次数

favoriteData 在 cloudFunction 的exports.favoriteTrigger.functions.firestore.document.onCreate 中不可迭代

我有两个收藏。一个是jobs,另一个是users

用户可以选择最喜欢的类别名称。我存储在User集合中...在里面job我存储所有类别categoryName

job当向该作业插入新作业时,categoryName == user selected categoryName我触发了向设备推送通知。

只是要知道:我存储设备令牌tokens集合。

插入新作业时出现错误消息Function log'

类型错误:favoriteData 在 cloudFunction (/srv/node_modules/firebase-functions/lib/cloud-functions.js) 的导出.favoriteTrigger.functions.firestore.document.onCreate (/srv/index.js:57:25) 处不可迭代: 131:23) 在 /worker/worker.js:825:24 在 process._tickDomainCallback (internal/process/next_tick.js:229:7)

exports.favoriteTrigger = functions.firestore.document('jobs/{any}')
.onCreate((snapshot,context)=>{
    var categoryName = [];
    var equalCategory = [];
    if(snapshot.empty){
        console.log('No Jobs in Jobs Collection');
        return null;
    }else{
        favoriteData = snapshot.data();
        for(var jobC of favoriteData){ //57:25 line code. error is coming here
            categoryName.push(jobC.data().categoryName);
        }
    admin.firestore().collection('users').get().then((snapshot)=>{
        var userCategory …
Run Code Online (Sandbox Code Playgroud)

javascript firebase google-cloud-platform google-cloud-functions

1
推荐指数
1
解决办法
982
查看次数

如何在flutter上获取移动国家代码

如何使用 flutter 获取电话国家代码?

(+972, +92)

我尝试过与localOf. 但我无法获取国家代码。

Locale myLocale = Localizations.localeOf(context);
Run Code Online (Sandbox Code Playgroud)

输出是US, or en-US

dart flutter

1
推荐指数
1
解决办法
4924
查看次数

如何使用 Flutter 获得真正的方向步骤?(绘制真实路线)

我正在使用出租车应用程序。是否可以使用颤振在真实道路上绘制真实路线?

我用这种方式:https : //developers.google.com/maps/documentation/directions/intro#ExampleRequests

  getDirectionSteps(double destinationLat, double destinationLng) {
    network
        .get("origin=" +
            location.latitude.toString() +
            "," +
            location.longitude.toString() +
            "&destination=" +
            destinationLat.toString() +
            "," +
            destinationLng.toString() +
            "&key=api_key")
        .then((dynamic res) {
      List<Steps> rr = res;
      print(res.toString());

      ccc = new List();
      for (final i in rr) {
        ccc.add(i.startLocation);
        ccc.add(i.endLocation);
      }

      mapView.onMapReady.listen((_) {
        mapView.setMarkers(getMarker(location.latitude,location.longitude,destinationLat,destinationLng));
        mapView.addPolyline(new Polyline("12", ccc, width: 15.0));
      });
      _screenListener.dismissLoader();
      showMap();
    }).catchError((Exception error) => _screenListener.dismissLoader());
  }
Run Code Online (Sandbox Code Playgroud)

我的输出是这样的:

在此处输入图片说明

但我需要这样:(在真实道路上绘制目的地路线)

在此处输入图片说明

google-maps google-maps-api-3 dart flutter

1
推荐指数
1
解决办法
3510
查看次数

Flutter Ios 不允许使用资源叉、Finder 信息或类似的碎屑

这是一个 Flutter 项目。我为 dev 和 prod 使用了 Flavor 和两个不同的主文件。

在实际设备上运行时收到此错误消息。我没有检查模拟器。我该如何解决这个问题?

我试图用这种方式解决这个问题。但不工作。我不这样做是正确的方式。我开始进行ios开发。/sf/answers/2776733991/

我也试过这种方式,我在ios文件夹中 xattr -lr pwd然后 xattr -cr pwd

错误

CodeSign /Users/myName/Library/Developer/Xcode/DerivedData/Runner-eqlnuvcbgrvptadbnflmaqpmnpuk/Build/Products/Debug-dev-iphoneos/Demo\ app\ Dev.app (in target 'Runner' from project 'Runner')
    cd /Users/myName/AndroidStudioProjects/demo_app/ios
    export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate

Signing Identity:     "Apple Development: My Name (3YT9RVYQUA)"
Provisioning Profile: "iOS Team Provisioning Profile: com.demo.demo"
                      (f510aq0c-122c-3d99-c947-c2440s4bd06d)

    /usr/bin/codesign --force --sign F342223C2F11B79BD9B0B991D9E324B2A3F41B37 --entitlements /Users/myName/Library/Developer/Xcode/DerivedData/Runner-eqlnuvcbgrvptadbnflmaqpmnpuk/Build/Intermediates.noindex/Runner.build/Debug-dev-iphoneos/Runner.build/demo\ app\ Dev.app.xcent --timestamp=none /Users/myName/Library/Developer/Xcode/DerivedData/Runner-eqlnuvcbgrvptadbnflmaqpmnpuk/Build/Products/Debug-dev-iphoneos/demo\ app\ Dev.app

/Users/myName/Library/Developer/Xcode/DerivedData/Runner-eqlnuvcbgrvptadbnflmaqpmnpuk/Build/Products/Debug-dev-iphoneos/demo app Dev.app: resource fork, Finder information, or similar detritus not allowed
Command CodeSign failed with a nonzero …
Run Code Online (Sandbox Code Playgroud)

macos ios dart swift flutter

1
推荐指数
1
解决办法
803
查看次数