This commit is contained in:
@@ -6,7 +6,7 @@ class Project {
|
||||
final String name;
|
||||
final String language;
|
||||
final File path;
|
||||
final List<Editor> editors;
|
||||
final List<String> editors;
|
||||
final bool isGit;
|
||||
final bool enableTerminal;
|
||||
|
||||
@@ -19,14 +19,15 @@ class Project {
|
||||
this.enableTerminal,
|
||||
);
|
||||
|
||||
factory Project.validated(
|
||||
factory Project.newValidated(
|
||||
String name,
|
||||
String lang,
|
||||
String path,
|
||||
List<Editor> editors,
|
||||
List<String> editors,
|
||||
bool enableTerminal,
|
||||
) {
|
||||
final File fpath = File(path);
|
||||
print(fpath.absolute.path);
|
||||
if (fpath.existsSync()) {
|
||||
print("Project not found!!!");
|
||||
} else {
|
||||
@@ -38,6 +39,28 @@ class Project {
|
||||
return Project(name, lang, fpath, editors, isGit, enableTerminal);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
"name": name,
|
||||
"language": language,
|
||||
"path": path.path,
|
||||
"editors": editors,
|
||||
"isGit": isGit,
|
||||
"enableTerminal": enableTerminal,
|
||||
};
|
||||
}
|
||||
|
||||
factory Project.fromJson(Map<String, dynamic> data) {
|
||||
return Project(
|
||||
data["name"] as String,
|
||||
data["language"] as String,
|
||||
File(data["path"] as String),
|
||||
(data["editors"] as List<dynamic>).map((a) => a.toString()).toList(),
|
||||
data["isGit"] as bool,
|
||||
data["enableTerminal"] as bool,
|
||||
);
|
||||
}
|
||||
|
||||
// bool validatePath(){
|
||||
// return File
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user