fixed analysis/search entrypoints treeshaken in release mode

This commit is contained in:
Thibault Deckers 2022-07-25 15:47:54 +02:00
parent 600b5a9635
commit c14b68f045
7 changed files with 19 additions and 10 deletions

View file

@ -4,6 +4,7 @@ import 'package:aves/widget_common.dart';
const _flavor = AppFlavor.huawei; const _flavor = AppFlavor.huawei;
@pragma('vm:entry-point')
void main() => mainCommon(_flavor); void main() => mainCommon(_flavor);
@pragma('vm:entry-point') @pragma('vm:entry-point')

View file

@ -4,6 +4,7 @@ import 'package:aves/widget_common.dart';
const _flavor = AppFlavor.izzy; const _flavor = AppFlavor.izzy;
@pragma('vm:entry-point')
void main() => mainCommon(_flavor); void main() => mainCommon(_flavor);
@pragma('vm:entry-point') @pragma('vm:entry-point')

View file

@ -4,6 +4,7 @@ import 'package:aves/widget_common.dart';
const _flavor = AppFlavor.play; const _flavor = AppFlavor.play;
@pragma('vm:entry-point')
void main() => mainCommon(_flavor); void main() => mainCommon(_flavor);
@pragma('vm:entry-point') @pragma('vm:entry-point')

View file

@ -19,6 +19,7 @@ class AnalysisService {
static Future<void> registerCallback() async { static Future<void> registerCallback() async {
try { try {
await _platform.invokeMethod('registerCallback', <String, dynamic>{ await _platform.invokeMethod('registerCallback', <String, dynamic>{
// callback needs to be annotated with `@pragma('vm:entry-point')` to work in release mode
'callbackHandle': PluginUtilities.getCallbackHandle(_init)?.toRawHandle(), 'callbackHandle': PluginUtilities.getCallbackHandle(_init)?.toRawHandle(),
}); });
} on PlatformException catch (e, stack) { } on PlatformException catch (e, stack) {
@ -40,6 +41,7 @@ class AnalysisService {
const _channel = MethodChannel('deckers.thibault/aves/analysis_service_background'); const _channel = MethodChannel('deckers.thibault/aves/analysis_service_background');
@pragma('vm:entry-point')
Future<void> _init() async { Future<void> _init() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
initPlatformServices(); initPlatformServices();

View file

@ -12,6 +12,7 @@ class GlobalSearch {
static Future<void> registerCallback() async { static Future<void> registerCallback() async {
try { try {
await _platform.invokeMethod('registerCallback', <String, dynamic>{ await _platform.invokeMethod('registerCallback', <String, dynamic>{
// callback needs to be annotated with `@pragma('vm:entry-point')` to work in release mode
'callbackHandle': PluginUtilities.getCallbackHandle(_init)?.toRawHandle(), 'callbackHandle': PluginUtilities.getCallbackHandle(_init)?.toRawHandle(),
}); });
} on PlatformException catch (e, stack) { } on PlatformException catch (e, stack) {
@ -20,6 +21,7 @@ class GlobalSearch {
} }
} }
@pragma('vm:entry-point')
Future<void> _init() async { Future<void> _init() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();

View file

@ -210,7 +210,7 @@ packages:
name: dbus name: dbus
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.7.4" version: "0.7.7"
decorated_icon: decorated_icon:
dependency: "direct main" dependency: "direct main"
description: description:
@ -224,7 +224,7 @@ packages:
name: device_info_plus name: device_info_plus
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.0.0" version: "4.0.1"
device_info_plus_linux: device_info_plus_linux:
dependency: transitive dependency: transitive
description: description:
@ -259,7 +259,7 @@ packages:
name: device_info_plus_windows name: device_info_plus_windows
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.1" version: "3.0.1"
dynamic_color: dynamic_color:
dependency: "direct main" dependency: "direct main"
description: description:
@ -298,12 +298,12 @@ packages:
source: hosted source: hosted
version: "1.3.1" version: "1.3.1"
ffi: ffi:
dependency: transitive dependency: "direct overridden"
description: description:
name: ffi name: ffi
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.1" version: "2.0.1"
fijkplayer: fijkplayer:
dependency: "direct main" dependency: "direct main"
description: description:
@ -678,7 +678,7 @@ packages:
name: package_info_plus name: package_info_plus
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.4.2" version: "1.4.3"
package_info_plus_linux: package_info_plus_linux:
dependency: transitive dependency: transitive
description: description:
@ -713,7 +713,7 @@ packages:
name: package_info_plus_windows name: package_info_plus_windows
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.5" version: "2.0.0"
palette_generator: palette_generator:
dependency: "direct main" dependency: "direct main"
description: description:
@ -764,7 +764,7 @@ packages:
name: path_provider_windows name: path_provider_windows
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.7" version: "2.1.0"
pdf: pdf:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1277,7 +1277,7 @@ packages:
name: win32 name: win32
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.6.1" version: "2.7.0"
wkt_parser: wkt_parser:
dependency: transitive dependency: transitive
description: description:

View file

@ -70,7 +70,7 @@ dependencies:
pdf: pdf:
percent_indicator: percent_indicator:
permission_handler: permission_handler:
printing: 5.9.1 printing:
proj4dart: proj4dart:
provider: provider:
screen_brightness: screen_brightness:
@ -90,6 +90,8 @@ dependency_overrides:
git: git:
url: https://github.com/deckerst/flutter-permission-handler url: https://github.com/deckerst/flutter-permission-handler
path: permission_handler_android path: permission_handler_android
# TODO TLAD remove override when this is fixed: https://github.com/DavBfr/dart_pdf/issues/1104
ffi: ">=1.1.0 <3.0.0"
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: