Skip to content

Commit 9d9e350

Browse files
author
Salim Lachdhaf
committed
fix lint issues
1 parent 5a5d7e7 commit 9d9e350

File tree

12 files changed

+259
-315
lines changed

12 files changed

+259
-315
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
## [2.0.9] - 2024.08.29
1+
## [2.0.10] - 2025.08.29
2+
* fix lints
3+
## [2.0.9] - 2025.08.29
24
* fix bug [#43](https://github.com/salim-lachdhaf/dartFTP/issues/43)
35
## [2.0.7] - 2024.02.25
46
* fix bug [#18](https://github.com/salim-lachdhaf/dartFTP/issues/18) thnx @ChaseGuru

analysis_options.yaml

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1 @@
1-
# https://www.dartlang.org/guides/language/analysis-options
2-
# Source of linter options:
3-
# http://dart-lang.github.io/linter/lints/options/options.html
4-
analyzer:
5-
errors:
6-
# treat missing required parameters as a warning (not a hint)
7-
missing_required_param: warning
8-
9-
linter:
10-
rules:
11-
# these rules are documented on and in the same order as
12-
# the Dart Lint rules page to make maintenance easier
13-
# https://github.com/dart-lang/linter/blob/master/example/all.yaml
14-
# - always_declare_return_types
15-
# - always_specify_types
16-
# - annotate_overrides
17-
# - avoid_as
18-
- avoid_empty_else
19-
- avoid_init_to_null
20-
- avoid_return_types_on_setters
21-
- await_only_futures
22-
- camel_case_types
23-
- cancel_subscriptions
24-
- close_sinks
25-
# - comment_references # we do not presume as to what people want to reference in their dartdocs
26-
# - constant_identifier_names # https://github.com/dart-lang/linter/issues/204
27-
- control_flow_in_finally
28-
- empty_constructor_bodies
29-
- empty_statements
30-
- hash_and_equals
31-
- implementation_imports
32-
# - invariant_booleans
33-
# - iterable_contains_unrelated_type
34-
- library_names
35-
# - library_prefixes
36-
# - list_remove_unrelated_type
37-
# - literal_only_boolean_expressions
38-
- non_constant_identifier_names
39-
# - one_member_abstracts
40-
# - only_throw_errors
41-
# - overridden_fields
42-
- package_names
43-
- package_prefixed_library_names
44-
- prefer_is_not_empty
45-
# - prefer_mixin # https://github.com/dart-lang/language/issues/32
46-
# - public_member_api_docs
47-
- slash_for_doc_comments
48-
# - sort_constructors_first
49-
# - sort_unnamed_constructors_first
50-
- test_types_in_equals
51-
- throw_in_finally
52-
# - type_annotate_public_apis # subset of always_specify_types
53-
- type_init_formals
54-
# - unawaited_futures
55-
- unnecessary_brace_in_string_interps
56-
- unnecessary_getters_setters
57-
- unnecessary_statements
58-
- unrelated_type_equality_checks
59-
- valid_regexps
1+
include: package:lints/recommended.yaml

example/main.dart

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,98 +3,98 @@ import 'dart:io';
33
import 'package:ftpconnect/ftpconnect.dart';
44

55
void main() async {
6-
final FTPConnect _ftpConnect = new FTPConnect(
6+
final FTPConnect ftpConnect = FTPConnect(
77
"users.on.net",
88
user: "pvpt",
99
pass: "Lachdhaf",
1010
showLog: true,
1111
);
1212

1313
///an auxiliary function that manage showed log to UI
14-
Future<void> _log(String log) async {
14+
Future<void> log(String log) async {
1515
print(log);
1616
await Future.delayed(Duration(seconds: 1));
1717
}
1818

1919
///mock a file for the demonstration example
20-
Future<File> _fileMock({fileName = 'FlutterTest.txt', content = ''}) async {
20+
Future<File> fileMock({fileName = 'FlutterTest.txt', content = ''}) async {
2121
final Directory directory = Directory('/test')..createSync(recursive: true);
2222
final File file = File('${directory.path}/$fileName');
2323
await file.writeAsString(content);
2424
return file;
2525
}
2626

27-
Future<void> _uploadStepByStep() async {
27+
Future<void> uploadStepByStep() async {
2828
try {
29-
await _log('Connecting to FTP ...');
30-
await _ftpConnect.connect();
31-
await _ftpConnect.changeDirectory('upload');
32-
File fileToUpload = await _fileMock(
29+
await log('Connecting to FTP ...');
30+
await ftpConnect.connect();
31+
await ftpConnect.changeDirectory('upload');
32+
File fileToUpload = await fileMock(
3333
fileName: 'uploadStepByStep.txt', content: 'uploaded Step By Step');
34-
await _log('Uploading ...');
35-
await _ftpConnect.uploadFile(fileToUpload);
36-
await _log('file uploaded sucessfully');
37-
await _ftpConnect.disconnect();
34+
await log('Uploading ...');
35+
await ftpConnect.uploadFile(fileToUpload);
36+
await log('file uploaded sucessfully');
37+
await ftpConnect.disconnect();
3838
} catch (e) {
39-
await _log('Error: ${e.toString()}');
39+
await log('Error: ${e.toString()}');
4040
}
4141
}
4242

43-
Future<void> _uploadWithRetry() async {
43+
Future<void> uploadWithRetry() async {
4444
try {
45-
File fileToUpload = await _fileMock(
45+
File fileToUpload = await fileMock(
4646
fileName: 'uploadwithRetry.txt', content: 'uploaded with Retry');
47-
await _log('Uploading ...');
48-
await _ftpConnect.connect();
49-
await _ftpConnect.changeDirectory('upload');
47+
await log('Uploading ...');
48+
await ftpConnect.connect();
49+
await ftpConnect.changeDirectory('upload');
5050
bool res =
51-
await _ftpConnect.uploadFileWithRetry(fileToUpload, pRetryCount: 2);
52-
await _log('file uploaded: ' + (res ? 'SUCCESSFULLY' : 'FAILED'));
53-
await _ftpConnect.disconnect();
51+
await ftpConnect.uploadFileWithRetry(fileToUpload, pRetryCount: 2);
52+
await log('file uploaded: ${res ? 'SUCCESSFULLY' : 'FAILED'}');
53+
await ftpConnect.disconnect();
5454
} catch (e) {
55-
await _log('Downloading FAILED: ${e.toString()}');
55+
await log('Downloading FAILED: ${e.toString()}');
5656
}
5757
}
5858

59-
Future<void> _downloadWithRetry() async {
59+
Future<void> downloadWithRetry() async {
6060
try {
61-
await _log('Downloading ...');
61+
await log('Downloading ...');
6262

6363
String fileName = '../512KB.zip';
64-
await _ftpConnect.connect();
64+
await ftpConnect.connect();
6565
//here we just prepare a file as a path for the downloaded file
66-
File downloadedFile = await _fileMock(fileName: 'downloadwithRetry.txt');
67-
bool res = await _ftpConnect
66+
File downloadedFile = await fileMock(fileName: 'downloadwithRetry.txt');
67+
bool res = await ftpConnect
6868
.downloadFileWithRetry(fileName, downloadedFile, pRetryCount: 2);
69-
await _log('file downloaded ' +
70-
(res ? 'path: ${downloadedFile.path}' : 'FAILED'));
71-
await _ftpConnect.disconnect();
69+
await log(
70+
'file downloaded ${res ? 'path: ${downloadedFile.path}' : 'FAILED'}');
71+
await ftpConnect.disconnect();
7272
} catch (e) {
73-
await _log('Downloading FAILED: ${e.toString()}');
73+
await log('Downloading FAILED: ${e.toString()}');
7474
}
7575
}
7676

77-
Future<void> _downloadStepByStep() async {
77+
Future<void> downloadStepByStep() async {
7878
try {
79-
await _log('Connecting to FTP ...');
79+
await log('Connecting to FTP ...');
8080

81-
await _ftpConnect.connect();
81+
await ftpConnect.connect();
8282

83-
await _log('Downloading ...');
83+
await log('Downloading ...');
8484
String fileName = '../512KB.zip';
8585

8686
//here we just prepare a file as a path for the downloaded file
87-
File downloadedFile = await _fileMock(fileName: 'downloadStepByStep.txt');
88-
await _ftpConnect.downloadFile(fileName, downloadedFile);
89-
await _log('file downloaded path: ${downloadedFile.path}');
90-
await _ftpConnect.disconnect();
87+
File downloadedFile = await fileMock(fileName: 'downloadStepByStep.txt');
88+
await ftpConnect.downloadFile(fileName, downloadedFile);
89+
await log('file downloaded path: ${downloadedFile.path}');
90+
await ftpConnect.disconnect();
9191
} catch (e) {
92-
await _log('Downloading FAILED: ${e.toString()}');
92+
await log('Downloading FAILED: ${e.toString()}');
9393
}
9494
}
9595

96-
await _uploadStepByStep();
97-
await _uploadWithRetry();
98-
await _downloadWithRetry();
99-
await _downloadStepByStep();
96+
await uploadStepByStep();
97+
await uploadWithRetry();
98+
await downloadWithRetry();
99+
await downloadStepByStep();
100100
}

lib/ftpconnect.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
library ftpconnect;
1+
library;
22

33
export 'src/ftp_exceptions.dart';
44
export 'src/ftpconnect_base.dart';

lib/src/commands/file.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ class FTPFile {
4343
_socket.transferType != TransferType.binary) {
4444
//check if ascii mode get refused
4545
//change to binary mode if ascii mode refused
46-
final _socketTransferTypeBackup = _socket.transferType;
46+
final socketTransferTypeBackup = _socket.transferType;
4747
await _socket.setTransferType(TransferType.binary);
4848
sResponse = await (_socket.sendCommand('SIZE $sFilename'));
4949
//back to default mode
50-
await _socket.setTransferType(_socketTransferTypeBackup);
50+
await _socket.setTransferType(socketTransferTypeBackup);
5151
}
5252
return int.parse(sResponse.message.replaceAll('213 ', ''));
5353
} catch (e) {

0 commit comments

Comments
 (0)