Flutter Web Integration?
KundKMC opened this issue · 21 comments
Hey guys. Is there a reason why you did not implement stuff for the flutter web platform? We use web, android and ios for our app.
Hi Markus!
Generally, we hadn't a request for it before.
We will add web platform support soon.
This would be great and hopefully won't be that difficult. Since your library works perfectly on both iOS and Android, the web integration would be a nice addition to complete the whole stack and integrate Fingerprint to be used as a device login token as well. I'm really looking forward to the update. If you need any help with the plugin, feel free to contact me.
Yup. Waiting on this too. Any idea of a rough time estimate?
We prepared a prerelease with web platform support https://pub.dev/packages/fpjs_pro_plugin/versions/1.2.3-dev.1
Can you try this one and give feedback?
Check step 3.3 of the readme please, FLutter had silly distributing instruments for js assets.
Thanks so much! Will do over the next few days/week.
Hey, same here: Thanks so much! Will check it out over the next few days/week.
I installed the code and I get:
UnknownError: NoSuchMethodError: method not found: 'U' on null
when calling:
fp = await FpjsProPlugin.getVisitorId() ?? 'null';
Initialisation & Code loading seem to work already.
I'm unable to do more debugging ;( I published the stack trace:
https://sentry.io/share/issue/2f72025da26b46e8b9fed581fbb86f23/
But that doesn't seem to be very helpful
@KundKMC did you add the js script to your page?
<script src="assets/packages/fpjs_pro_plugin/web/index.js" defer></script>
Looks weird, but looks like it is a usual way for flutter =(
Indeed it does. The Integration itself seems to work. It even loads https://fpnpmcdn.net/v3/XXXXXXX/loader_v3.8.1.js
The problem occurs when doing fp = await FpjsProPlugin.getVisitorId() ?? 'null'; in the initState section of a page
I build a function:
Future getFingerprint() async {
String fp = "";
try {
fp = await FpjsProPlugin.getVisitorId() ?? 'null';
} catch (exception, stackTrace) {}
return fp;
}
Where the exception is thrown. The function is called from within:
initState() {
................
getFingerprint();
super.initState();
}
Thank you. I'll investigate it today!
I found only the bug with empty params, but stacktrace differs. (I'll fix it today).
This variant works for me.
class _MyHomePageState extends State<MyHomePage> {
Future<void> getFingerprint() async {
await FpjsProPlugin.initFpjs('<PublicKey>');
String fp = "";
fp = await FpjsProPlugin.getVisitorId(tags: {}) ?? 'null';
print(fp);
}
@override
void initState() {
super.initState();
getFingerprint();
}
}
Can you run a dev build? (I use IDEA/AndroidStudio for it). Because your stacktrace looks more like a production build.
Fixed empty tags
problem in 1.2.3-dev.2
Hi, thanks for the Update. I did a retest (with flutter build web --profile --dart-define=Dart2jsOptimization=O0)
And now I get a more detailed error:
https://sentry.io/share/issue/69141d5750a44398bd1a7f6e7c0f26e5/
UnknownError: Converting circular structure to JSON
--> starting at object with constructor 'Rti'
| property '_cachedRuntimeType' -> object with constructor '_Type'
--- property '_rti' closes the circle
Hopefully you know, whats going on ;)
It Seems to be something with the region, maybe? My init is:
await FpjsProPlugin.initFpjs('KEY', region: Region.eu);
Thank you!
Now I managed to reproduce this issue.
I developed it in dartdevc
env and forgot to check in dart2js
. Now it fixed. Please try this version: 1.2.3-dev.3
Thank you! The module is now working fine for me. Looking forward to use it in our prod environment. Will you create a new prod release, soon?
Yes, we will do it today.
Thank you!