Skip to content

Commit 2402631

Browse files
authored
v9.1.2: fixed web complation (acts as no-op) (#165)
1 parent 9268675 commit 2402631

File tree

10 files changed

+102
-49
lines changed

10 files changed

+102
-49
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ Many thanks to my sponsors, no matter how much or how little they donated. Spons
1818

1919
# Changelog
2020

21+
## [9.1.2] - 2024/08/07
22+
23+
* Fixed compilation on web platforms: FMTC now internally overrides the `FMTCObjectBoxBackend` and becomes a no-op
24+
* Minor documentation improvements
25+
2126
## [9.1.1] - 2024/07/16
2227

2328
* Fixed bug where errors within the import functionality would not be catchable by the original invoker

example/lib/screens/configure_download/components/numerical_input_row.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class _NumericalInputRowState extends State<NumericalInputRow> {
8989
FilteringTextInputFormatter.digitsOnly,
9090
_NumericalRangeFormatter(
9191
min: widget.min,
92-
max: widget.max ?? 9223372036854775807,
92+
max: widget.max ?? double.maxFinite.toInt(),
9393
),
9494
],
9595
onChanged: (newVal) => widget.onChanged(

example/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: The example application for 'flutter_map_tile_caching', showcasing
33
it's functionality and use-cases.
44
publish_to: "none"
55

6-
version: 9.1.1
6+
version: 9.1.2
77

88
environment:
99
sdk: ">=3.3.0 <4.0.0"

lib/src/backend/export_external.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
// A full license can be found at .\LICENSE
33

44
export 'errors/errors.dart';
5-
export 'impls/objectbox/backend/backend.dart';
5+
export 'impls/web_noop/backend.dart'
6+
if (dart.library.ffi) 'impls/objectbox/backend/backend.dart';
67
export 'interfaces/backend/backend.dart';
78
export 'interfaces/backend/internal.dart';
89
export 'interfaces/backend/internal_thread_safe.dart';

lib/src/backend/impls/objectbox/backend/backend.dart

+12
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,18 @@ part 'internal_workers/thread_safe.dart';
3131
part 'errors.dart';
3232
part 'internal.dart';
3333

34+
/// {@template fmtc.backend.objectbox}
3435
/// Implementation of [FMTCBackend] that uses ObjectBox as the storage database
36+
///
37+
/// On web, this redirects to a no-op implementation that throws
38+
/// [UnsupportedError]s when attempting to use [initialise] or [uninitialise],
39+
/// and [RootUnavailable] when trying to use any other method.
40+
/// {@endtemplate}
3541
final class FMTCObjectBoxBackend implements FMTCBackend {
3642
/// {@macro fmtc.backend.initialise}
3743
///
44+
/// {@template fmtc.backend.objectbox.initialise}
45+
///
3846
/// ---
3947
///
4048
/// [maxDatabaseSize] is the maximum size the database file can grow
@@ -50,6 +58,7 @@ final class FMTCObjectBoxBackend implements FMTCBackend {
5058
/// thread.
5159
///
5260
/// Avoid using [useInMemoryDatabase] outside of testing purposes.
61+
/// {@endtemplate}
5362
@override
5463
Future<void> initialise({
5564
String? rootDirectory,
@@ -68,11 +77,14 @@ final class FMTCObjectBoxBackend implements FMTCBackend {
6877

6978
/// {@macro fmtc.backend.uninitialise}
7079
///
80+
/// {@template fmtc.backend.objectbox.uninitialise}
81+
///
7182
/// If [immediate] is `true`, any operations currently underway will be lost,
7283
/// as the worker will be killed as quickly as possible (not necessarily
7384
/// instantly).
7485
/// If `false`, all operations currently underway will be allowed to complete,
7586
/// but any operations started after this method call will be lost.
87+
/// {@endtemplate}
7688
@override
7789
Future<void> uninitialise({
7890
bool deleteRoot = false,

lib/src/backend/impls/objectbox/models/generated/objectbox.g.dart

+40-41
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright © Luka S (JaffaKetchup) under GPL-v3
2+
// A full license can be found at .\LICENSE
3+
4+
import 'package:flutter/services.dart';
5+
import 'package:meta/meta.dart';
6+
7+
import '../../../../flutter_map_tile_caching.dart';
8+
9+
/// {@macro fmtc.backend.objectbox}
10+
final class FMTCObjectBoxBackend implements FMTCBackend {
11+
static const _noopMessage =
12+
'FMTC is not supported on non-FFI platforms by default';
13+
14+
/// {@macro fmtc.backend.initialise}
15+
///
16+
/// {@macro fmtc.backend.objectbox.initialise}
17+
@override
18+
Future<void> initialise({
19+
String? rootDirectory,
20+
int maxDatabaseSize = 10000000,
21+
String? macosApplicationGroup,
22+
RootIsolateToken? rootIsolateToken,
23+
@visibleForTesting bool useInMemoryDatabase = false,
24+
}) =>
25+
throw UnsupportedError(_noopMessage);
26+
27+
/// {@macro fmtc.backend.uninitialise}
28+
///
29+
/// {@macro fmtc.backend.objectbox.uninitialise}
30+
@override
31+
Future<void> uninitialise({
32+
bool deleteRoot = false,
33+
bool immediate = false,
34+
}) =>
35+
throw UnsupportedError(_noopMessage);
36+
}

lib/src/misc/int_extremes.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import 'package:meta/meta.dart';
55

66
/// Largest fully representable integer in Dart
77
@internal
8-
const largestInt = 9223372036854775807;
8+
final largestInt = double.maxFinite.toInt();
99

1010
/// Smallest fully representable integer in Dart
1111
@internal
12-
const smallestInt = -9223372036854775808;
12+
final smallestInt = -double.maxFinite.toInt();

pubspec.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: flutter_map_tile_caching
22
description: Plugin for 'flutter_map' providing advanced caching functionality,
33
with ability to download map regions for offline use.
4-
version: 9.1.1
4+
version: 9.1.2
55

66
repository: https://github.com/JaffaKetchup/flutter_map_tile_caching
77
issue_tracker: https://github.com/JaffaKetchup/flutter_map_tile_caching/issues
@@ -40,7 +40,7 @@ dependencies:
4040
objectbox: ^4.0.1
4141
objectbox_flutter_libs: ^4.0.1
4242
path: ^1.9.0
43-
path_provider: ^2.1.3
43+
path_provider: ^2.1.4
4444

4545
dev_dependencies:
4646
build_runner: ^2.4.11

windowsApplicationInstallerSetup.iss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
; Script generated by the Inno Setup Script Wizard
22

33
#define MyAppName "FMTC Demo"
4-
#define MyAppVersion "for 9.1.1"
4+
#define MyAppVersion "for 9.1.2"
55
#define MyAppPublisher "JaffaKetchup Development"
66
#define MyAppURL "https://github.com/JaffaKetchup/flutter_map_tile_caching"
77
#define MyAppSupportURL "https://github.com/JaffaKetchup/flutter_map_tile_caching/issues"

0 commit comments

Comments
 (0)