I'm currently learning Flutter development (as well as Dart). It's my first mobile programming language.
I'm curious - is there a way to split screens into .dart files, or do they all have to be in the same main.dart file?
The app I'm building will have a lot of pages, so I don't want to make one giant main.dart file with 20+ different pages.
Is Flutter the right choice if I'm trying to make a large application like this?
You can split your code in as many files as you want. It's encouraged to have as little code as possible in lib/main.dart and all the other code split into various files. The only limitation is that code in one file (library) can not access private members of other files.
See How to reference another file in Dart? for how to import other Dart files.
Related
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
I am trying to read the two files first one is a text file and the second one is an excel file. I'm using flutter web 2.10 but can't find a way to read those files. I have tried this method but it doesn't work now To read and Write File in Flutter Web
Currently, I am kinda stuck with it. For now, I am reading the text file as a string and then parsing it, but it is not a good way to do it. So if you have any better way to read files in flutter web please do share.
Uint8List? bytes=result.files.first.bytes;
file=File.fromRawPath(bytes!);
file.readAsLines();
returnResult=file.toString();
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.
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.
Resonantly I had to work with .gfx file, but i haven't got much information about gfx file.
My question is:
What is a .gfx file formated file contains?
is that any kind of image file or video file.
Where can i get a .gfx sample file to test?
is there any framework that support .gfx in iOS SDK?
1)
According to Google, GFX is used as an extension for at least five different kinds of files. My first guess is that you're thinking of a 3D model/scene format, which might be used in some kinds of games.
2)
That last web page I referred to lists a sample .gfx file.
3)
And this answer depends on exactly which kind of file, out of the five different types of files listed on the eHow page, is the kind of file you want to work with.