fix
This commit is contained in:
parent
d3750df342
commit
c81dfdf5c9
|
@ -47,7 +47,7 @@ Future<void> _importPosts(fileUri) async {
|
|||
}
|
||||
|
||||
// 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);
|
||||
|
||||
// Write posts.json
|
||||
|
@ -71,7 +71,7 @@ Future<void> _postRandomPost() async {
|
|||
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) {
|
||||
return;
|
||||
|
@ -93,7 +93,7 @@ void main(List<String> args) async {
|
|||
}
|
||||
|
||||
// Import posts from files
|
||||
await _importPosts('/posts.txt');
|
||||
await _importPosts('/data/posts.txt');
|
||||
|
||||
// Post a random post
|
||||
await _postRandomPost();
|
||||
|
|
Loading…
Reference in a new issue