This commit is contained in:
Inex Code 2022-05-05 19:49:41 +00:00
parent c81dfdf5c9
commit 94ac7cfcb6
2 changed files with 7 additions and 7 deletions

View File

@ -37,6 +37,7 @@ Future<void> _importPosts(fileUri) async {
for (final line in lines) { for (final line in lines) {
if (line.isEmpty && post != '') { if (line.isEmpty && post != '') {
posts.add(post); posts.add(post);
print('Added post: $post');
} else { } else {
post += '$line\n'; post += '$line\n';
} }
@ -44,6 +45,7 @@ Future<void> _importPosts(fileUri) async {
if (post != '') { if (post != '') {
posts.add(post); posts.add(post);
print('Added post: $post');
} }
// Read posts.json and add posts to it // Read posts.json and add posts to it
@ -96,14 +98,14 @@ void main(List<String> args) async {
await _importPosts('/data/posts.txt'); await _importPosts('/data/posts.txt');
// Post a random post // Post a random post
await _postRandomPost(); // await _postRandomPost();
// Post a random post at random time // Post a random post at random time
// Random time is between 1 and 8 hours // Random time is between 1 and 8 hours
// Random time is choosen after every post // Random time is choosen after every post
while (true) { // while (true) {
await Future.delayed(Duration(hours: Random().nextInt(8) + 1)); // await Future.delayed(Duration(hours: Random().nextInt(8) + 1));
await _postRandomPost(); // await _postRandomPost();
} // }
} }

View File

@ -10,8 +10,6 @@ environment:
dependencies: dependencies:
args: ^2.0.0 args: ^2.0.0
dio: ^4.0.6 dio: ^4.0.6
shelf: ^1.1.0
shelf_router: ^1.0.0
dev_dependencies: dev_dependencies:
http: ^0.13.0 http: ^0.13.0