Skip to content

Commit 0386a16

Browse files
committed
简化dart中的类型判断方式
1 parent b93f5c3 commit 0386a16

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def generate_code(work_bean):
222222
out_res += (line + '\n')
223223
if first and r'.fromParams({this.' in line:
224224
class_name = line.split(r'.fromParams({this.')[0].strip()
225-
out_res += '\n factory %s(jsonStr) => jsonStr.runtimeType == String ? %s.fromJson(json.decode(jsonStr)) : %s.fromJson(jsonStr);\n' \
225+
out_res += '\n factory %s(jsonStr) => jsonStr is String ? %s.fromJson(json.decode(jsonStr)) : %s.fromJson(jsonStr);\n' \
226226
% (class_name, class_name, class_name)
227227
first = False
228228
return out_res

0 commit comments

Comments
 (0)