fixed rendering bug on linux + ip configuration

This commit is contained in:
2025-10-15 14:20:31 +02:00
parent 86e89b5ed8
commit 74a918d62b
7 changed files with 146 additions and 24 deletions

View File

@ -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);