diff --git a/tools/goctl/api/dartgen/genvars.go b/tools/goctl/api/dartgen/genvars.go index 51a9fa13..72ee6bdc 100644 --- a/tools/goctl/api/dartgen/genvars.go +++ b/tools/goctl/api/dartgen/genvars.go @@ -31,7 +31,7 @@ Future getTokens() async { try { var sp = await SharedPreferences.getInstance(); var str = sp.getString('tokens'); - if (str.isEmpty) { + if (str == null || str.isEmpty) { return null; } return Tokens.fromJson(jsonDecode(str)); @@ -65,7 +65,7 @@ Future getTokens() async { try { var sp = await SharedPreferences.getInstance(); var str = sp.getString('tokens'); - if (str.isEmpty) { + if (str == null || str.isEmpty) { return null; } return Tokens.fromJson(jsonDecode(str));