This commit is contained in:
Inex Code 2022-05-05 19:44:43 +00:00
parent d3750df342
commit c81dfdf5c9
1 changed files with 3 additions and 3 deletions

View File

@ -47,7 +47,7 @@ Future<void> _importPosts(fileUri) async {
} }
// Read posts.json and add posts to it // Read posts.json and add posts to it
final postsJson = json.decode(await File('posts.json').readAsString()) as List<String>; final postsJson = json.decode(await File('posts.json').readAsString());
postsJson.addAll(posts); postsJson.addAll(posts);
// Write posts.json // Write posts.json
@ -71,7 +71,7 @@ Future<void> _postRandomPost() async {
return; return;
} }
final postsJson = json.decode(await File('posts.json').readAsString()) as List<String>; final postsJson = json.decode(await File('posts.json').readAsString());
if (postsJson.isEmpty) { if (postsJson.isEmpty) {
return; return;
@ -93,7 +93,7 @@ void main(List<String> args) async {
} }
// Import posts from files // Import posts from files
await _importPosts('/posts.txt'); await _importPosts('/data/posts.txt');
// Post a random post // Post a random post
await _postRandomPost(); await _postRandomPost();