如果您的要求只是空的或 null,您可以使用 Dart 的nullsafe运算符使其更简洁:
if (routeinfo?["no_route"]?.isEmpty ?? true) {
//
}
相关讨论:https://stackoverflow.com/questions/42446566/dart-null-false-empty-checking-how-to-write-this-shorter如果您的要求只是空的或 null,您可以使用 Dart 的nullsafe运算符使其更简洁:
if (routeinfo?["no_route"]?.isEmpty ?? true) {
//
}
相关讨论:https://stackoverflow.com/questions/42446566/dart-null-false-empty-checking-how-to-write-this-shorter