fixed rendering bug on linux + ip configuration
This commit is contained in:
@ -43,7 +43,13 @@ class StorageService {
|
||||
}
|
||||
|
||||
final List<dynamic> jsonList = json.decode(contents);
|
||||
return jsonList.map((json) => Project.fromJson(json)).toList();
|
||||
return jsonList.map((json) {
|
||||
// Migration: Add ipAddress field if it doesn't exist (for backwards compatibility)
|
||||
if (!json.containsKey('ipAddress')) {
|
||||
json['ipAddress'] = '127.0.0.1'; // Default IP address
|
||||
}
|
||||
return Project.fromJson(json);
|
||||
}).toList();
|
||||
} catch (e) {
|
||||
return [];
|
||||
}
|
||||
@ -64,7 +70,13 @@ class StorageService {
|
||||
|
||||
final contents = await importFile.readAsString();
|
||||
final List<dynamic> jsonList = json.decode(contents);
|
||||
final projects = jsonList.map((json) => Project.fromJson(json)).toList();
|
||||
final projects = jsonList.map((json) {
|
||||
// Migration: Add ipAddress field if it doesn't exist (for backwards compatibility)
|
||||
if (!json.containsKey('ipAddress')) {
|
||||
json['ipAddress'] = '127.0.0.1'; // Default IP address
|
||||
}
|
||||
return Project.fromJson(json);
|
||||
}).toList();
|
||||
|
||||
// Save the imported projects
|
||||
await saveProjects(projects);
|
||||
|
||||
Reference in New Issue
Block a user