home controller file picker
This commit is contained in:
@@ -67,8 +67,7 @@ class HomeController extends GetxController {
|
|||||||
try {
|
try {
|
||||||
// Datei auswählen
|
// Datei auswählen
|
||||||
FilePickerResult? result = await FilePicker.platform.pickFiles(
|
FilePickerResult? result = await FilePicker.platform.pickFiles(
|
||||||
type: FileType.custom,
|
type: FileType.any,
|
||||||
allowedExtensions: ['json'],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ class FilamentRepository extends GetxService {
|
|||||||
final data = _storage.read(_storageKey);
|
final data = _storage.read(_storageKey);
|
||||||
//Wenn nichts gespeichert ist, gebe die Mockup Liste zurück
|
//Wenn nichts gespeichert ist, gebe die Mockup Liste zurück
|
||||||
if (data == null) return FilamentModel.mockupFilamentList;
|
if (data == null) return FilamentModel.mockupFilamentList;
|
||||||
|
|
||||||
return (data as List)
|
return (data as List)
|
||||||
.map((json) => FilamentModel.fromJson(json))
|
.map((json) => FilamentModel.fromJson(json))
|
||||||
.toList();
|
.toList();
|
||||||
@@ -152,4 +151,5 @@ class FilamentRepository extends GetxService {
|
|||||||
final filaments = getAllFilaments();
|
final filaments = getAllFilaments();
|
||||||
return filaments.where((f) => f.type == type).toList();
|
return filaments.where((f) => f.type == type).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user