Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Dart 不确定如何在运算符之前解析空感知_Dart - Fatal编程技术网

Dart 不确定如何在运算符之前解析空感知

Dart 不确定如何在运算符之前解析空感知,dart,Dart,我得到一个警告 The left operand uses '?.', so its value can be null 从这行代码 code = username?.hashCode % 7 ?? 0 % 7; 不确定最佳实践是什么以及为什么 在执行空检查之前,您正在尝试使用%7运算符。您可能正在调用null%7,这肯定不起作用。把它移出你的空支票 code=(用户名?.hashCode±0)%7; 在执行null检查之前,您正在尝试使用%7运算符。您可能正在调用null%7,这肯定不起作

我得到一个警告

The left operand uses '?.', so its value can be null
从这行代码

code = username?.hashCode % 7 ?? 0 % 7;

不确定最佳实践是什么以及为什么

在执行空检查之前,您正在尝试使用
%7
运算符。您可能正在调用
null%7
,这肯定不起作用。把它移出你的空支票

code=(用户名?.hashCode±0)%7;

在执行null检查之前,您正在尝试使用
%7
运算符。您可能正在调用
null%7
,这肯定不起作用。把它移出你的空支票

code=(用户名?.hashCode±0)%7;