我试图在注销时删除所有内容。
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) 我使用了共享包,共享包文档说这样添加,
\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\nError 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 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) 以前,该功能有效。但我添加了一些代码,现在这个错误来了。如何解决这个问题?
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) 如何检查接口变量上的 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)
- 目前我正在这样检查
我很开始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) 我有两个收藏。一个是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
如何使用 flutter 获取电话国家代码?
(+972, +92)
我尝试过与localOf
. 但我无法获取国家代码。
Locale myLocale = Localizations.localeOf(context);
Run Code Online (Sandbox Code Playgroud)
输出是US, or en-US
我正在使用出租车应用程序。是否可以使用颤振在真实道路上绘制真实路线?
我用这种方式: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)
我的输出是这样的:
但我需要这样:(在真实道路上绘制目的地路线)
这是一个 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) dart ×6
flutter ×6
firebase ×3
google-maps ×1
ios ×1
javascript ×1
macos ×1
node.js ×1
react-select ×1
reactjs ×1
swift ×1
typescript ×1