草庐IT

getter-only

全部标签

flutter - 如何修复 'NoSuchMethodError: The getter ' 长度' was called on null'

我该如何解决这个问题我使用函数从api获取数据,但我看到错误“NoSuchMethodError:getter'length'wascalledonnull'我的代码:FuturegetData()async{http.Responseresponse=awaithttp.get('https://myappres.000webhostapp.com/pubg/api.php?action=getskin');debugPrint(response.body);_data=json.decode(response.body);_list=_data['categorys'];retur

flutter - 如何修复 "The getter ' 长度'在 null 上被调用

我已经使用了FutureBuilder,但仍然有这个问题这是我的主体代码,我已经使用了futurebuilder,但仍然存在长度问题。我不明白这一点。FutureBuilder(future:showPosts(),builder:(context,snapshot){returnListView.builder(itemCount:snapshot.data.length,itemBuilder:(context,index){returnCard(color:Color(0xFFE1F5FE),child:Column(mainAxisSize:MainAxisSize.min,c

http - Flutter:单例数据,getter 在 null 上调用

在我从http请求中检索到数据(一个用户)之后,我想将这些数据放入一个单例中。然后,在另一个View中,我想在边栏中显示该用户的名称,但它显示“Thegetter'user'wascalledonnull”。这是我的代码:varuser=awaitgetUser(_username,_password);if(user.loginError==false){model.user=user;Navigator.of(context).pushNamedAndRemoveUntil('/home_view',ModalRoute.withName('/home_view'));}这是我尝试

dart - Flutter调用showTimePicker函数报错: The getter 'modalBarrierDismissLabel' was called on null

@overrideWidgetbuild(BuildContextcontext){returnMaterialApp(home:Scaffold(appBar:AppBar(title:Text("HelloFlutter"),),body:Column(children:[GestureDetector(onTap:(){showTimePicker(context:context,initialTime:constTimeOfDay(hour:7,minute:0),);},child:Text("22:30"))像这样尝试将timePicker添加到我的Flutter应用程序中

dart - getter 'value' 在 null 上被调用

我正在尝试在flutter中创建此字体大小动画,但我收到以下错误:getter'value'wascalledonnull。这看起来很奇怪,因为我有另一个包含类似代码的dart文件并且它运行良好。如有任何帮助,我们将不胜感激。Animation_fontSizeAnimation;AnimationController_fontSizeAnimationController;初始化状态函数():super.initState();_fontSizeAnimationController=newAnimationController(duration:newDuration(millis

firebase - 我/flutter (14318) : NoSuchMethodError: Class 'FirebaseUser' has no instance getter 'firstname'

我正在尝试更新我正在构建的应用程序用户的用户配置文件。用户信息存储在firebase中,应用程序在运行在android上的dart中编码。我已经尝试实现来自https://firebase.google.com/docs/auth/web/manage-users的示例网站。51createUser(){52if(checkFields()){53//PerformLogin54varuser=FirebaseAuth.instance.currentUser();55FirebaseAuth.instance56.createUserWithEmailAndPassword(emai

dart - getter 中的 future 对象

我在我的getter中为我的Locale变量调用一个future对象。如何让返回值等待呢?classChangeLocalewithChangeNotifier{Locale_locale;Localegetlocale{getLanguage().then((LocaleprefLocale){_locale=prefLocale;});return_locale;}setlocale(LocalenewValue){print(newValue);_locale=newValue;notifyListeners();}} 最佳答案

dart - 没有声明顶级 getter <className>

我正在扩展flutter_gallery示例。我尝试创建新的画廊项目newGalleryItem(title:'Journal',subtitle:'Exampleappcoding',category:'Apps',routeName:JournalDemo.routeName,buildRoute:(BuildContextcontext)=>newJournalDemo()),我导入了import'../journal/journal_all.dart';里面我有export'journal_demo.dart';JournalDemo类和ListDemo是同一个类,我只改了类名

dart - flutter.io "NoSuchMethodError: The getter ' isMacOS' 被调用为空。”

我一直想玩flutter.io有一段时间了,今天开始安装它。我正在关注flutter网站上的入门页面,但在运行“flutterdoctor”时遇到以下错误消息……我做错了什么吗?或者解决这个问题的解决方法?Oops;flutterhasexitedunexpectedly.SendingcrashreporttoGoogle.Crashreportsent(reportID:8a4b9d16bec30469)Unhandledexception:NoSuchMethodError:Thegetter'isMacOS'wascalledonnull.Receiver:nullTriedc

flutter - getter 'navigator' 在 null 上被调用

从今天早上开始就一直报这个错,看了stacktrace,追查到runApp方法上的报错,不明白总之,问题是什么,我们将不胜感激:)这是个异常(exception):getter'navigator'wascalledonnull这是我的main.dart文件import'dart:async';import'package:firebase_analytics/firebase_analytics.dart';import'package:firebase_analytics/observer.dart';import'package:flutter/material.dart';im