Ad
Is There A Way To Run A Flutter App On Web When The App Uses A Plugin Which Is Not Developed For Web
I am using firebase_dynamic_links
in my app and I wish to deploy the app on the web. firebase_dynamic_links
is not implemented for flutter web.
Now, I am using dynamic links in just one file. is it possible for me to use a separate code file just for the web version that does not use dynamic links?
The code is pretty extensive and the part consisting of dynamic links is pretty small, I don't want to maintain a separate repo just because of this.
Ad
Answer
You could simply wrap it in:
try{
// app code
}catch(e){
// web code
}
You could also try:
import 'dart:io';
if(Platform.isAndroid){
// app code
}
else{
// web code
}
Although I've found that this will sometimes throw an error on the web, so you might want to wrap it it a try/catch.
You could also do:
import 'package:flutter/foundation.dart' show kIsWeb;
if (kIsWeb){
\\ web code
}
else{
\\ app code
}
Ad
source: stackoverflow.com
Related Questions
- → How can I query Firebase for an equalTo boolean parameter?
- → How can I access nested data in Firebase with React?
- → Firebase simple blog (confused with security rules)
- → Removing item in Firebase with React, re-render returns item undefined
- → AngularJS Unknown Provider Error (Firebase & AngularFire)
- → How do you pass top level component state down to Routes using react-router?
- → "this" is null in firebase query function in reactjs
- → Angular Module Failed to Load
- → Multiple dex files define Lcom/google/android/gms/internal/zzrx;
- → Joining Firebase tables in React
- → How can I make add firepad to my reactjs project?
- → How to use Cloud Functions for Firebase to prerender pages for SEO?
- → React.js component has null state?
Ad