Display ePub Files Using Flutter - flutter

Having solely developed Android applications I have decided to try crossplatform development, so far Flutter has been a much more pleasant experience than Xamarin however, I have now run into a roadblock.
I want to give users the ability to read ePub files downloaded from my server. I came across this Flutter package but it is not clear to me how to display the ePub inside a container to the user - https://pub.dartlang.org/packages/epub
I cannot find any examples/tutorials other than the one provided on the example page (which has a Image package conflict. I fixed this conflict by changing the package import line to 'import package:image/image.dart' as image) then all references to it in the main method to image.Image. This might be another issue to resolve another day when it comes to adding custom placeholders for missing images.
I cannot share my ePub files but I have tested with the one found on the github repository here https://github.com/orthros/dart-epub/blob/dev/test/hittelOnGoldMines.epub
Thank you

The only resource that I found was https://github.com/pycampers/flutter_pdf_viewer, but for now it is just for Android.
Another aproach is to load a webview and load the pdf using some JS framework.

Related

Flutter web not loading images

Hi I wanted to upload my website today but I realized that I can't use images as AssetImage. After looking for a solution I found a possible way where I use NetworkImage with the url
yoururl/assets/assets/image.jpg for example.
Now this isn't working for me as well. I tried running it with the command flutter run -d -chrome --webkit-renderer html but this didn't work as well.
What other possibilities would work here? is there maybe some site where I could upload my images?
When using asset images on the web, remove the assets at the beginning of the asset path.
Sample ;
Normal state : "assets/images/someImage.png",
Web : "/images/someImage.png"

Dealing with pdf files

I am implementing an application which its main idea is reading books using it.
the pdf files are on my server and I want the user to read the book without saving it on their device.
I thought about streaming the pdf file or embedding it. but it has some difficulties.
So, what is the best solution for this issue?
I am using Django-Rest-framework and Flutter
i think you have to use list of this packages for reading pdf files into flutter.
https://pub.dev/packages/syncfusion_flutter_pdf
https://pub.dev/packages/syncfusion_flutter_pdfviewer

Is it possible to download and execute an uncompiled dart file (Flutter)

I am trying to make an extension based app, where you can download extensions to the app to add features/widgets. Could I somehow run an uncompiled dart file downloaded from a server that stores the .dart files?
download(file.dart)
compile(file.dart)
storeInPersistentDirectory()
if (dartFile.exists) {
ClassFromDownloadedFile.sayHello()
}
The aim is to decrease the app size by storing all of the data related to an extension in the dart file, (classes, json and images in the form of a string...). Users might want to download features, while some don’t need them, in which case they shouldn’t need to download a large app with many features that they will never use, so the initial app size remains small.
Thank you for anyone who knows anything relating to this in advance!
No, it is not possible. You can download a 'resource' such as image/video/mp3 etc. You can even download the dart file but can't compile and execute.
there is a concept in dart and other modern languages called reflection(mirroring).
Reflection allows us to examine and modify the structure and behavior
of a program at runtime.
search about it and check the below links for more information.
dart document
Understanding Reflection and Annotations in Dart
I recommend searching for RMI too.

Multi-page Airconsole controller?

I'm just starting to create a controller for use with Airconsole. I'd like it to be somewhat complicated and will be using Angular to create different pages.
In Unity, I can drag in a controller.html file. However, I've been getting resource not found errors when I try to access say controller.js or controller.css. How can I upload multliple files to the Airconsole host? Is there a general pattern used by other games?
So far I'm considering
hosting my app separately and just redirecting to my separate web page. This seems to give errors in the emulator though.
Compiling the entire app into just one HTML file.. Not sure how to get these entirely into one file. When I run ng build I get a smaller dist compiled file, but it still consists of several smaller files. Will try dragging that into Unity and trying again. But dragging the entire Angular project inside Unity felt like a really bad idea..
Link to files hosted on separate pages but still have the uploaded HTML file do something.. But not sure how much I need to do here vs how much I can move to other files that I host.
You can create your controller using controller.html with Angular (1?!), have different pages (e.g. via ng-include and the angular routing module) and upload everything to AirConsole (developers).
By using ng-include you can have multiple .html views you dynamically load into the controller.html.
I once wrote an example app for AirConsole and Angular:
https://github.com/francois-n-dream/airconsole-angular-phaser
Just think of it as if you would make a (mobile) website which in addition uses the AirConsole API for device communication.
My basic "how to include other files" question was answered well by another question: How to include js and css.
For the more generic question of working with Angular, I still haven't quite figured it out. But what I'm doing at the moment:
I have an Angular project outside of Unity. I run ng build to compile everything into a folder dist. Then two options work:
Deploy the dist folder to static file hosting and change index.html's relative links to point to the separately hosted files with <base href="https://cloudfilehosting/airconsole-host/">
OR
Copy the dist folder into Unity's Assets/WebGLTemplates/AirConsole folder.

Is there a way to programmatically download a web page, for offline viewing, using WebKit?

What I'd like to be able to do is download any web page, and be able to view it offline.
It seems like html WebKit views cannot be converted to PDFs (on the Mac, you could 'print' a PDF, but that isn't possible on iPhone?).
So, the only way is to save the actual resources - save the html, the step thru each image, css, js file and save it locally. Then maybe alter the urls within the code so they point to the right place...etc ...etc...
Is there a standard way to do this?
Or, is there an open source project (in any programming lang) which does this kind of thing?
There's an excellent webkit html to pdf converter appropriately called wkhtmltopdf. Given the reources available on the iphone and its toolkits, I think it'd be easy to compile a version for the i-Phone ('think' being the operative word). We've managed to use the tool in a Windows, Linux and Solaris environment with absolutely no bugs. Here's the link:
http://code.google.com/p/wkhtmltopdf/