Comments (8)
yes adding @pragma('vm:entry-point')
to callbackDispatcher and the onEvents method solved the issue. Thanks. is it recommended to be added to every event listener?
from flutter-radar.
Can you try adding the vm entry point to the callbackDispatcher
instead like such
@pragma('vm:entry-point')
void callbackDispatcher() {
const MethodChannel _backgroundChannel =
MethodChannel('flutter_radar_background');
WidgetsFlutterBinding.ensureInitialized();
_backgroundChannel.setMethodCallHandler((MethodCall call) async {
final args = call.arguments;
final CallbackHandle handle = CallbackHandle.fromRawHandle(args[0]);
final Function? callback = PluginUtilities.getCallbackFromHandle(handle);
final Map res = args[1];
callback?.call(res);
});
}
It may also be helpful to add the following to your proguard-rules.pro while debugging:
// this will force R8 to not keep all Radar related classes
-keep class io.radar.** { *; }
// This will print all the classes that were removed by the obfuscation
-printusage debug-dir/usage.txt
// This will print the classes that "seed" what is kept by the obfuscation
-printseeds debug-dir/seeds.txt
from flutter-radar.
Thanks for the fix, but using it didn't work. I'm getting error
E/flutter (26098): [ERROR:flutter/lib/ui/dart_runtime_hooks.cc(38)] Dart Error: Dart_LookupLibrary: library 'package:hot_frontend/screens/MapScreen.dart' not found.
from flutter-radar.
I haven't been able to exactly follow the workaround as the file structure/logic have changed so couldn't tell if this solution works or not. Also, is this issue reproducible by radar team as I'm getting it in example radar project too?
flutter/flutter#91841 (comment)
flutter/flutter#91841 (comment)
from flutter-radar.
I am seeing a different error on the example app.
E/flutter (27400): [ERROR:flutter/lib/ui/dart_runtime_hooks.cc(38)] Dart Error: Class '_MyAppState' not found in library ''.
E/flutter (27400): [ERROR:flutter/shell/common/shell.cc(117)] Dart Error: Class '_MyAppState' not found in library ''.
I think the new entry point annotation was able to resolve the issue of the obfuscation but may introduce a new issue. We are looking into it.
from flutter-radar.
I was able to suppress the errors that I was getting on the example app by adding the same annotation to the static methods we want to use as callbacks.
@pragma('vm:entry-point')
static void onEvents(Map res) {
print('📍📍 onEvents: $res');
}
.....
Radar.onEvents(onEvents);
This is done in addition to adding the annotation to the callbackDispatcher
as described in #41 (comment)
from flutter-radar.
Yes, all event listeners are "passed into the native layer". As such, we need to add the annotation for them so that they can be executed when the native code executes the callback.
We will be cutting a release with this fix soon! Hopefully this workaround is sufficient in the meantime.
from flutter-radar.
issue patched in v3.9.1
from flutter-radar.
Related Issues (11)
- Radar SDK isn't consistent with updating values and does not support offline or batch sync HOT 1
- Migrate to null safety HOT 2
- Install Radar with Kotlin & Swift? HOT 4
- Flutter SDK Geofencing capabilities HOT 3
- Radar.onEvents() never called HOT 10
- Warnings of depreciated API and unsafe/unchecked operations on android build
- reverseGeocode should use named parameters and follow API specification HOT 1
- Radar SDK Listeners should not need to be marked static to allow for instance members to be utilized in logic HOT 3
- Autocomplete null object reference error HOT 2
- Listeners not being called in background (when app is closed)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter-radar.