更新后颤动我只有当我删除应用程序并发布新应用程序时才会出现此错误。如果我只是热重新加载我发现此错误并且地图正确启动。 我确定它是在更新后扑腾的。我保存了每个集合验证,现在这个问题可以重复使用以前的所有备份,并且我确定在删除并重新安装应用程序后验证此功能
libobject_patch.dart中的
@patch
dynamic noSuchMethod(Invocation invocation) {
// TODO(regis): Remove temp constructor identifier 'withInvocation'.
throw new NoSuchMethodError.withInvocation(this, invocation);
}
控制台中的
E/flutter (28250): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter (28250): NoSuchMethodError: The method 'substring' was called on null.
E/flutter (28250): Receiver: null
E/flutter (28250): Tried calling: substring(1, 10)
E/flutter (28250): #0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:46:5)
E/flutter (28250): #1 _ContentState.initState.<anonymous closure> (file:///C:/Users/utilisateur/Desktop/nirbiapp/lib/Content.dart:145:40)
E/flutter (28250): #2 _RootZone.runUnaryGuarded (dart:async/zone.dart:1316:10)
E/flutter (28250): #3 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:330:11)
E/flutter (28250): #4 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:257:7)
E/flutter (28250): #5 _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:132:11)
E/flutter (28250): #6 _MapStream._handleData (dart:async/stream_pipe.dart:232:10)
E/flutter (28250): #7 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:164:13)
E/flutter (28250): #8 _RootZone.runUnaryGuarded (dart:async/zone.dart:1316:10)
E/flutter (28250): #9 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:330:11)
E/flutter (28250): #10 _DelayedData.perform (dart:async/stream_impl.dart:578:14)
E/flutter (28250): #11 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:694:11)
E/flutter (28250): #12 _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:654:7)
E/flutter (28250): #13 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter (28250): #14 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
扑医生
C:\flutter\bin\flutter.bat --no-color doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.4.4, on Microsoft Windows [version
10.0.16299.431], locale fr-FR)
[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[√] Android Studio (version 3.0)
[√] VS Code, 64-bit edition (version 1.21.1)
[√] Connected devices (1 available)
• No issues found!
Process finished with exit code 0
我在这里放置showMap时出现此错误:
_loadgeoValue() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
setState(() {
lat = (prefs.getDouble('lat'));
long = (prefs.getDouble('long'));
});
showMap();
}
如果我启动showMap();在Onpressed Button之后我没有问题。 但如果我这样做,我就不知道如何用lat和long变量更新地图。
目前,当我收到带有坐标的短信时,我会启动地图,为此,
1 /我发送带有按下按钮的短信
2 /我用以下内容阅读回复:SmsReceiver()。onSmsReceived.listen((SmsMessage msg)
3 / I用正则表达式提取坐标(lat long)
4 /我使用共享偏好保存值
5 /保存后,我用lat和long坐标启动mapview
答案 0 :(得分:0)
我用自己的号码替换if(msg.address ==“+ 33 $ nirbinumber1”)来测试并确定比较的成就。尝试调用:substring(1,10)与其他行一起删除,但我总是libobject_patch.dart显示
这是带子串(1,10)
的代码 String nirbinumber ;
loadnirbinumber() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
setState(() {
nirbinumber = (prefs.getString('number1'));
});
}
@override
void initState() {
super.initState();
loadnirbinumber(); //function to read programed number
new SmsReceiver().onSmsReceived.listen((SmsMessage msg) { // function to listen entry sms
var nirbinumber1= nirbinumber.substring(1, 10); //function to extract first number 0X XX XX XX XX
if (msg.address == "+33$nirbinumber1") // Action after compare input sms with programed number +33X XX XX XX XX
{
setState(() {
_lastMessage = msg;
});
RegExp regExp = new RegExp( //Here is the regex function to isolate first word of sms
r"^([\w\-]+)",
);
var match = regExp.firstMatch(_lastMessage.body);
group1 = match.group(1);
if ( group1 =="maps"){
MapView.setApiKey('AIzaSyCNYMslm35FPWYFGkJVMk7aAOd174TUCGQ');
_savegeoValue(); // this function use shared preference to save, extract, and load map
}
}
}
);
}
我用正则表达式替换,它删除子字符串错误但没有noSuchMethode
new SmsReceiver().onSmsReceived.listen((SmsMessage msg) {
RegExp regExp = new RegExp(
r"^0([0-9]{9})",
);
var match = regExp.firstMatch(nirbinumber);
group1 = match.group(1);
if (msg.address == "+33$group1") {
setState(() {
_lastMessage = msg;
});