chore: coding style (#4644)

This commit is contained in:
Kevin Wan
2025-02-12 23:48:39 +08:00
committed by GitHub
parent 7a4818da59
commit f113d512e8
5 changed files with 22 additions and 20 deletions

View File

@@ -10,10 +10,10 @@ const (
import 'package:shared_preferences/shared_preferences.dart';
import '../data/tokens.dart';
/// 保存tokens到本地
/// store tokens to local
///
/// 传入null则删除本地tokens
/// 返回true设置成功 false:设置失败
/// pass null will clean local stored tokens
/// returns true if success, otherwise false
Future<bool> setTokens(Tokens tokens) async {
var sp = await SharedPreferences.getInstance();
if (tokens == null) {
@@ -23,9 +23,9 @@ Future<bool> setTokens(Tokens tokens) async {
return await sp.setString('tokens', jsonEncode(tokens.toJson()));
}
/// 获取本地存储的tokens
/// get local stored tokens
///
/// 如果没有,则返回null
/// if no, returns null
Future<Tokens> getTokens() async {
try {
var sp = await SharedPreferences.getInstance();
@@ -82,7 +82,8 @@ func genVars(dir string, isLegacy bool, scheme string, hostname string) error {
}
if !fileExists(dir + "vars.dart") {
err = os.WriteFile(dir+"vars.dart", []byte(fmt.Sprintf(`const serverHost='%s://%s';`, scheme, hostname)), 0o644)
err = os.WriteFile(dir+"vars.dart", []byte(fmt.Sprintf(`const serverHost='%s://%s';`,
scheme, hostname)), 0o644)
if err != nil {
return err
}

View File

@@ -59,11 +59,11 @@ type (
// Member describes the field of a structure
Member struct {
Name string
// 数据类型字面值,如:string、map[int]string、[]int64、[]*User
// data type, for example, string、map[int]string、[]int64、[]*User
Type Type
Tag string
Comment string
// 成员头顶注释说明
// document for the field
Docs Doc
IsInline bool
}