@@ -92,7 +92,7 @@ Future<void> main(List<String> arguments) async {
92
92
userPrivateKey = "" ;
93
93
}
94
94
95
- if ( gUserLocation.length > 0 ){
95
+ if ( gUserLocation.isNotEmpty ){
96
96
print ("Going to add $gUserLocation as the location tag with each post." );
97
97
}
98
98
@@ -118,7 +118,7 @@ Future<void> main(List<String> arguments) async {
118
118
119
119
// write informative message in case user is not using proper keys
120
120
if ( userPublicKey == gDefaultPublicKey) {
121
- print ("You should ideally create your own private key and use it with ${ gWarningColor } --prikey$gColorEndMarker program argument. " );
121
+ print ("You should ideally create your own private key and use it with $gWarningColor --prikey$gColorEndMarker program argument. " );
122
122
print ("Create a private key from ${gWarningColor }astral.ninja, @damusapp, or even from command line using `openssl rand -hex 32`.$gColorEndMarker .\n " );
123
123
print ("npub/nsec keys can be converted to hex key format using https://damus.io/key" );
124
124
}
@@ -127,16 +127,16 @@ Future<void> main(List<String> arguments) async {
127
127
if ( argResults[relayArg] != null ) {
128
128
Set <String > userRelayList = Set .from (argResults[relayArg].split ("," ));
129
129
Set <String > parsedRelays = {};
130
- userRelayList. forEach (( relay) {
130
+ for ( var relay in userRelayList ) {
131
131
if (relay.startsWith (RegExp (r'^ws[s]?:\/\/' ))) {
132
132
parsedRelays.add (relay);
133
133
} else {
134
134
printWarning ("The provided relay entry: \" $relay \" does not start with ws:// or wss://, omitting" );
135
135
}
136
- });
136
+ }
137
137
138
138
// verify that there is at least one valid relay they provided, otherwise keep defaults
139
- if (parsedRelays.length > 0 ) {
139
+ if (parsedRelays.isNotEmpty ) {
140
140
gListRelayUrls = parsedRelays;
141
141
defaultServerUrl = gListRelayUrls.first;
142
142
} else {
@@ -174,8 +174,9 @@ Future<void> main(List<String> arguments) async {
174
174
175
175
try {
176
176
var terminalColumns = gDefaultTextWidth;
177
- if ( stdout.hasTerminal )
177
+ if ( stdout.hasTerminal ) {
178
178
terminalColumns = stdout.terminalColumns;
179
+ }
179
180
180
181
// can be computed only after textWidth has been found
181
182
if ( gTextWidth > terminalColumns) {
@@ -184,7 +185,7 @@ Future<void> main(List<String> arguments) async {
184
185
gNumLeftMarginSpaces = (terminalColumns - gTextWidth )~ / 2 ;
185
186
} on StdoutException catch (e) {
186
187
print ("Cannot find terminal size. Left aligning by default." );
187
- if ( gDebug > 0 ) log.info ("${ e .message }" );
188
+ if ( gDebug > 0 ) log.info (e.message);
188
189
gNumLeftMarginSpaces = 0 ;
189
190
}
190
191
// undo above if left option is given
@@ -262,10 +263,10 @@ Future<void> main(List<String> arguments) async {
262
263
stdout.write ('Reading events from ${whetherDefault }file.......' );
263
264
264
265
// read file events and give the events to relays from where they're picked up later
265
- initialEvents = await readEventsFromFile (gEventsFilename);
266
+ initialEvents = readEventsFromFile (gEventsFilename);
266
267
267
268
// count events
268
- initialEvents. forEach (( element) { numFileEvents++ ;});
269
+ for ( var element in initialEvents ) { numFileEvents++ ;}
269
270
print ("read $numFileEvents events from file $gEventsFilename " );
270
271
}
271
272
@@ -338,7 +339,7 @@ Future<void> main(List<String> arguments) async {
338
339
clearEvents ();
339
340
340
341
341
- initialEvents. forEach (( element) { element.eventData.kind == 1 ? numUserPosts++ : numUserPosts;});
342
+ for ( var element in initialEvents ) { element.eventData.kind == 1 ? numUserPosts++ : numUserPosts;}
342
343
numUserPosts -= numFilePosts;
343
344
stdout.write ("...done\n " );//received $numUserPosts new posts made by the user\n");
344
345
@@ -353,7 +354,9 @@ Future<void> main(List<String> arguments) async {
353
354
getKindEvents ([40 , 41 ], gListRelayUrls, limitPerSubscription, getSecondsDaysAgo (limitSelfEvents));
354
355
getKindEvents ([42 ], gListRelayUrls, 3 * limitPerSubscription, getSecondsDaysAgo (limitOthersEvents));
355
356
356
- initialEvents.forEach ((e) => processKind3Event (e)); // first process the kind 3 event ; basically populate the global structure that holds this info
357
+ for (var e in initialEvents) {
358
+ processKind3Event (e);
359
+ } // first process the kind 3 event ; basically populate the global structure that holds this info
357
360
358
361
Set <String > contacts = {};
359
362
Set <String > pTags = {};
@@ -365,9 +368,9 @@ Future<void> main(List<String> arguments) async {
365
368
// if contact list was found, get user's feed; also get some default contacts
366
369
if (contactEvent != null ) {
367
370
if (gDebug > 0 ) print ("In main: found contact list: \n ${contactEvent .originalJson }" );
368
- contactEvent.eventData.contactList. forEach ((contact ) {
371
+ for ( var contact in contactEvent.eventData.contactList) {
369
372
contacts.add (contact.contactPubkey);
370
- });
373
+ }
371
374
} else {
372
375
print ("Could not find your contact list." );
373
376
}
0 commit comments