Skip to content

Commit b4d4d82

Browse files
committed
v6.37.0
1 parent eaa55c9 commit b4d4d82

File tree

5 files changed

+51
-11
lines changed

5 files changed

+51
-11
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [6.37.0] - 2025-10-28
2+
3+
* Added `MetroService.createFile` method to create a file in your project
4+
* Update pubspec.yaml
5+
16
## [6.36.0] - 2025-10-12
27

38
* added `repeatOn` to PushNotification class to allow repeating notifications

example/pubspec.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,10 @@ packages:
194194
dependency: transitive
195195
description:
196196
name: flutter_local_notifications
197-
sha256: "7ed76be64e8a7d01dfdf250b8434618e2a028c9dfa2a3c41dc9b531d4b3fc8a5"
197+
sha256: "19ffb0a8bb7407875555e5e98d7343a633bb73707bae6c6a5f37c90014077875"
198198
url: "https://pub.dev"
199199
source: hosted
200-
version: "19.4.2"
200+
version: "19.5.0"
201201
flutter_local_notifications_linux:
202202
dependency: transitive
203203
description:
@@ -427,7 +427,7 @@ packages:
427427
path: ".."
428428
relative: true
429429
source: path
430-
version: "6.36.0"
430+
version: "6.37.0"
431431
path:
432432
dependency: transitive
433433
description:

lib/metro/metro_service.dart

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,24 @@ final Map<Type, NyApiService> apiDecoders = {${reg.allMatches(file).map((e) => e
839839
await _createNewFile(filePath, value);
840840
}
841841

842+
/// Create a new file at a [path] with a [value].
843+
/// You can override an existing file by setting [overrideFile] to true.
844+
/// You can also set the [fileMode], [encoding] and [flush] options
845+
static Future<bool> createFile(
846+
String path,
847+
value, {
848+
bool overrideFile = false,
849+
FileMode fileMode = FileMode.write,
850+
Encoding encoding = utf8,
851+
bool flush = false,
852+
}) async {
853+
return await _createNewFile(path, value,
854+
overrideFile: overrideFile,
855+
fileMode: fileMode,
856+
encoding: encoding,
857+
flush: flush);
858+
}
859+
842860
/// Check if a file exist by passing in a [path].
843861
static Future<bool> hasFile(String path) async => await File(path).exists();
844862

@@ -1129,14 +1147,31 @@ extension IterableExtension<T> on Iterable<T> {
11291147
}
11301148

11311149
/// Creates a new file from a [path] and [value].
1132-
Future<void> _createNewFile(String path, String value,
1133-
{Function()? onSuccess}) async {
1150+
Future<bool> _createNewFile(String path, String value,
1151+
{Function()? onSuccess,
1152+
bool overrideFile = true,
1153+
FileMode fileMode = FileMode.write,
1154+
Encoding encoding = utf8,
1155+
bool flush = false}) async {
11341156
final File file = File(path);
1135-
File fileCreated = await file.writeAsString(value);
1157+
if ((await file.exists())) {
1158+
if (!overrideFile) {
1159+
return false;
1160+
}
1161+
FileSystemEntity fileSystemEntity = await file.delete();
1162+
if (await fileSystemEntity.exists()) {
1163+
return false;
1164+
}
1165+
}
1166+
1167+
File fileCreated = await file.writeAsString(value,
1168+
mode: fileMode, encoding: encoding, flush: flush);
1169+
11361170
if (await fileCreated.exists()) {
1137-
if (onSuccess == null) return;
1171+
if (onSuccess == null) return true;
11381172
onSuccess();
11391173
}
1174+
return true;
11401175
}
11411176

11421177
/// Creates a new directory from a [path] if it doesn't exist.

pubspec.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,10 @@ packages:
202202
dependency: "direct main"
203203
description:
204204
name: flutter_local_notifications
205-
sha256: "7ed76be64e8a7d01dfdf250b8434618e2a028c9dfa2a3c41dc9b531d4b3fc8a5"
205+
sha256: "19ffb0a8bb7407875555e5e98d7343a633bb73707bae6c6a5f37c90014077875"
206206
url: "https://pub.dev"
207207
source: hosted
208-
version: "19.4.2"
208+
version: "19.5.0"
209209
flutter_local_notifications_linux:
210210
dependency: transitive
211211
description:

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: nylo_support
22
description: Support library for the Nylo framework. This library supports routing, widgets, localization, cli, storage and more.
3-
version: 6.36.0
3+
version: 6.37.0
44
homepage: https://nylo.dev
55
repository: https://github.com/nylo-core/support/tree/6.x
66
issue_tracker: https://github.com/nylo-core/support/issues
@@ -35,7 +35,7 @@ dependencies:
3535
error_stack: ^1.10.3
3636
date_field: ^6.0.3+1
3737
flutter_multi_formatter: ^2.13.10
38-
flutter_local_notifications: ^19.4.2
38+
flutter_local_notifications: ^19.5.0
3939
path_provider: ^2.1.5
4040
timezone: ^0.10.1
4141
flutter_timezone: ^5.0.0

0 commit comments

Comments
 (0)