Skip to content

Commit 7f8b72e

Browse files
committed
format codes
1 parent 2af60a8 commit 7f8b72e

File tree

4 files changed

+35
-35
lines changed

4 files changed

+35
-35
lines changed

example/lib/main.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class _MyHomePageState extends State<MyHomePage> {
126126
}
127127

128128
@override
129-
void dispose(){
129+
void dispose() {
130130
_unbindBackgroundIsolate();
131131
super.dispose();
132132
}

lib/flutter_downloader.dart

-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@ library flutter_downloader;
1717

1818
export 'src/downloader.dart';
1919
export 'src/models.dart';
20-

lib/src/downloader.dart

+26-23
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ import 'models.dart';
1616
/// * `progress`: current progress value of a download task, the value is in
1717
/// range of 0 and 100
1818
///
19-
typedef void DownloadCallback(String id, DownloadTaskStatus status, int progress);
19+
typedef void DownloadCallback(
20+
String id, DownloadTaskStatus status, int progress);
2021

2122
///
2223
/// A convenient class wraps all api functions of **FlutterDownloader** plugin
@@ -26,7 +27,8 @@ class FlutterDownloader {
2627
static bool _initialized = false;
2728

2829
static Future<Null> initialize() async {
29-
assert(!_initialized, 'FlutterDownloader.initialize() must be called only once!');
30+
assert(!_initialized,
31+
'FlutterDownloader.initialize() must be called only once!');
3032

3133
WidgetsFlutterBinding.ensureInitialized();
3234

@@ -62,12 +64,12 @@ class FlutterDownloader {
6264
///
6365
static Future<String> enqueue(
6466
{@required String url,
65-
@required String savedDir,
66-
String fileName,
67-
Map<String, String> headers,
68-
bool showNotification = true,
69-
bool openFileFromNotification = true,
70-
bool requiresStorageNotLow = true}) async {
67+
@required String savedDir,
68+
String fileName,
69+
Map<String, String> headers,
70+
bool showNotification = true,
71+
bool openFileFromNotification = true,
72+
bool requiresStorageNotLow = true}) async {
7173
assert(_initialized, 'FlutterDownloader.initialize() must be called first');
7274
assert(Directory(savedDir).existsSync());
7375

@@ -112,12 +114,12 @@ class FlutterDownloader {
112114
List<dynamic> result = await _channel.invokeMethod('loadTasks');
113115
return result
114116
.map((item) => new DownloadTask(
115-
taskId: item['task_id'],
116-
status: DownloadTaskStatus(item['status']),
117-
progress: item['progress'],
118-
url: item['url'],
119-
filename: item['file_name'],
120-
savedDir: item['saved_dir']))
117+
taskId: item['task_id'],
118+
status: DownloadTaskStatus(item['status']),
119+
progress: item['progress'],
120+
url: item['url'],
121+
filename: item['file_name'],
122+
savedDir: item['saved_dir']))
121123
.toList();
122124
} on PlatformException catch (e) {
123125
print(e.message);
@@ -155,12 +157,12 @@ class FlutterDownloader {
155157
print('Loaded tasks: $result');
156158
return result
157159
.map((item) => new DownloadTask(
158-
taskId: item['task_id'],
159-
status: DownloadTaskStatus(item['status']),
160-
progress: item['progress'],
161-
url: item['url'],
162-
filename: item['file_name'],
163-
savedDir: item['saved_dir']))
160+
taskId: item['task_id'],
161+
status: DownloadTaskStatus(item['status']),
162+
progress: item['progress'],
163+
url: item['url'],
164+
filename: item['file_name'],
165+
savedDir: item['saved_dir']))
164166
.toList();
165167
} on PlatformException catch (e) {
166168
print(e.message);
@@ -385,8 +387,9 @@ class FlutterDownloader {
385387
assert(_initialized, 'FlutterDownloader.initialize() must be called first');
386388

387389
final callbackHandle = PluginUtilities.getCallbackHandle(callback);
388-
assert(callbackHandle != null, 'callback must be a top-level or a static function');
389-
_channel.invokeMethod('registerCallback', <dynamic>[callbackHandle.toRawHandle()]);
390+
assert(callbackHandle != null,
391+
'callback must be a top-level or a static function');
392+
_channel.invokeMethod(
393+
'registerCallback', <dynamic>[callbackHandle.toRawHandle()]);
390394
}
391-
392395
}

lib/src/models.dart

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
21
///
32
/// A class defines a set of possible statuses of a download task
43
///
54
class DownloadTaskStatus {
65
final int _value;
76

8-
const DownloadTaskStatus(int value): _value = value;
7+
const DownloadTaskStatus(int value) : _value = value;
98

109
int get value => _value;
1110

@@ -15,8 +14,7 @@ class DownloadTaskStatus {
1514

1615
toString() => 'DownloadTaskStatus($_value)';
1716

18-
static DownloadTaskStatus from(int value) =>
19-
DownloadTaskStatus(value);
17+
static DownloadTaskStatus from(int value) => DownloadTaskStatus(value);
2018

2119
static const undefined = const DownloadTaskStatus(0);
2220
static const enqueued = const DownloadTaskStatus(1);
@@ -48,13 +46,13 @@ class DownloadTask {
4846

4947
DownloadTask(
5048
{this.taskId,
51-
this.status,
52-
this.progress,
53-
this.url,
54-
this.filename,
55-
this.savedDir});
49+
this.status,
50+
this.progress,
51+
this.url,
52+
this.filename,
53+
this.savedDir});
5654

5755
@override
5856
String toString() =>
5957
"DownloadTask(taskId: $taskId, status: $status, progress: $progress, url: $url, filename: $filename, savedDir: $savedDir)";
60-
}
58+
}

0 commit comments

Comments
 (0)