Skip to content

Commit a868ca5

Browse files
committed
Add fallback for renamed methods
1 parent 4860e35 commit a868ca5

File tree

6 files changed

+23
-9
lines changed

6 files changed

+23
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 4.0.1
2+
3+
- Add fallback for renamed methods.
4+
15
## 4.0.0
26

37
- **BREAKING** Rename `FileRASource.open` to `FileRASource.openPath`.

lib/src/file_ra_source.dart

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,19 @@ typedef PlatformFile = impl.PlatformFile;
88
abstract class FileRASource extends RandomAccessSource {
99
/// Opens a [FileRASource] from a file path.
1010
static Future<FileRASource> openPath(String path) =>
11-
impl.FileRASource.open(path);
11+
impl.FileRASource.openPath(path);
1212

1313
/// Loads a [FileRASource] from a [PlatformFile].
1414
static Future<FileRASource> loadFile(PlatformFile file) =>
15-
impl.FileRASource.load(file);
15+
impl.FileRASource.loadFile(file);
16+
17+
/// Opens a [FileRASource] from a file path.
18+
@Deprecated('Renamed to openPath')
19+
static Future<FileRASource> open(String path) =>
20+
impl.FileRASource.openPath(path);
21+
22+
/// Loads a [FileRASource] from a [PlatformFile].
23+
@Deprecated('Renamed to loadFile')
24+
static Future<FileRASource> load(PlatformFile file) =>
25+
impl.FileRASource.loadFile(file);
1626
}

lib/src/file_ra_source_stub.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import 'file_ra_source.dart' as base;
55
typedef PlatformFile = Object;
66

77
abstract class FileRASource extends base.FileRASource {
8-
static Future<FileRASource> open(String path) =>
8+
static Future<FileRASource> openPath(String path) =>
99
throw UnsupportedError('Not supported on this platform.');
1010

11-
static Future<FileRASource> load(PlatformFile file) =>
11+
static Future<FileRASource> loadFile(PlatformFile file) =>
1212
throw UnsupportedError('Not supported on this platform.');
1313

1414
@override

lib/src/file_ra_source_vm.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ class FileRASource extends base.FileRASource {
1010

1111
FileRASource._(this._file);
1212

13-
static Future<FileRASource> open(String path) async =>
13+
static Future<FileRASource> openPath(String path) async =>
1414
FileRASource._(await io.File(path).open());
1515

16-
static Future<FileRASource> load(PlatformFile file) async =>
16+
static Future<FileRASource> loadFile(PlatformFile file) async =>
1717
FileRASource._(await file.open());
1818

1919
@override

lib/src/file_ra_source_web.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ class FileRASource extends base.FileRASource {
1616

1717
FileRASource._(this._bytes);
1818

19-
static Future<base.FileRASource> open(String path) async {
19+
static Future<base.FileRASource> openPath(String path) async {
2020
final res = await _fetch(path.toJS).toDart;
2121
final bytes = (await res.bytes().toDart).toDart;
2222
return FileRASource._(BytesRASource(bytes));
2323
}
2424

25-
static Future<FileRASource> load(PlatformFile file) async {
25+
static Future<FileRASource> loadFile(PlatformFile file) async {
2626
final bytes = (await file.arrayBuffer().toDart).toDart.asUint8List();
2727
return FileRASource._(BytesRASource(bytes));
2828
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: random_access_source
22
description: A shared interface for common random access data.
3-
version: 4.0.0
3+
version: 4.0.1
44
repository: https://github.com/flutter-cavalry/random_access_source
55

66
environment:

0 commit comments

Comments
 (0)