Skip to content

Commit 971b602

Browse files
committed
Correção na classe _getArquivo()
1 parent ab7b2ed commit 971b602

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/main.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ class Home extends StatefulWidget {
1919
}
2020

2121
class _HomeState extends State<Home> {
22-
List<Map> _todoList = [];
23-
22+
List<dynamic> _todoList = [];
2423
Map<String, dynamic> _ultimoRemovido;
2524
int _ultimoRemovidoPosicao;
2625

@@ -163,7 +162,12 @@ class _HomeState extends State<Home> {
163162

164163
Future<File> _getArquivo() async {
165164
final diretorio = await getApplicationDocumentsDirectory();
166-
return File("${diretorio.path}/tarefas.json");
165+
final archive = File("${diretorio.path}/tarefas.json");
166+
if (archive.existsSync()) {
167+
return archive;
168+
} else {
169+
return File("${diretorio.path}/tarefas.json");
170+
}
167171
}
168172

169173
Future<File> _saveTarefas() async {

0 commit comments

Comments
 (0)