How to achieve single page app with multiple views in Dart? - gwt

I am migrating from GWT to Dart and would like to take the MVP pattern that I learned from building GWT apps and use them in Dart-land. I'm playing around with my first Dart app and would like it to be a "single-page" app, meaning that the view can change at the drop of a hat without forcing the user to suffer a page load. GWT solves this (in part) with it's Activities & Places API, and I'm wondering if Dart has anything similar.
What does Dart offer developers in the way of creating single-page apps, and if it doesn't, how do other Dart developers achieve single-page apps?
GWT uses codesplitting and fragmentation to minimize the amount of time the application takes to load. Does Dart offer anything like this, or can it be "hacked" to emulate these concepts?

1) Depending on frameworks there are different ways to do that. For instance angular.dart can handle views and routing. An other solution is the route package.
2) See Mulitple JavaScript files in Dart?

1) Using Polymer elements as views works fine too.

Related

What has been your experience of building a browser website using Flutter?

We've built an app through Flutter and realising that some of our user behaviour is best created for larger screens, where people are creating best on desktop. I've seen that the codebase is viable for transporting to a web experience. We want to avoid the desktop app and build for a browser.
Has anyone had experience with building for web browsers using Flutter?
What's been your experience? How good is the codebase for creating things such as:
Messengers
Posting and threads
Spaces, like Pinterest folders or Padlet like these - NewHope Crowdsource Space
This is the app on the store if that helps.
I'd greatly appreciate any feedback, thoughts or experiences you've had. I'm wondering whether to invest in Flutter for web browser or whether I need to go back to JS.
Thank you
We're exploring whether to develop the website through a different language and looking for people's experiences if they've attempted this.
The experience is not much different than mobile development, if you're used to it, really I recommend you usage this variant. Only one source code for all platforms.
In addition, the use of libraries is practically the same. The only thing that changes is that it compiles to HTML, CSS, and JavaScript.
I only recommend taking care of the adaptability to different screen sizes, using mediaQuery (height, width) and Expanded Widgets.
The rest stays the same, your HTTP requests (Dio is an excellent option). To work the logic layer also the BLoC design pattern helps a lot.

Flutter share native objects between plugins

I am working on a couple plugins for streaming and recording video. In Android land it is generally not possible to have two things access the camera simultaneously.
The obvious solution is to merge the two plugins into one that marshals/shares the resource.
This got me thinking. Is there any way to share native objects between plugins? I cannot find any documentation or resources on this.
Does anyone have a suggestion on how to achieve this?
I've been doing similar stuff - not with video but with raw data, and it is possible. There are two major approaches:
Share data between the packages via flutter medium - method + event channels with the proper implementation in all plugins.
Since you would have to implement a lot of boilerplate either way in both ios and android platforms, you as well may implement all the sharing directly in the native code. After all, you have access to all the plugins' native code in the native part of your flutter app. Just channel the data there correctly without including flutter at all(well, not at all - in the end, some trigger methods/events should exist either way).
I went down the second path, and it was not that hard to do. I'm not sure about your use case, but sharing the video stream between several end recipients is possible, so it should also be possible in the flutter app.

Why use ionic element tags/components vs standard html?

Whats the benefit of using ionic elements like ion-button, ion-item, ion-row, ion-text ion-img instead of regular html?
The first benefit is that each component has been implemented to work properly on mobile devices and with mobile events like clicks, taps, and so on (do you remember the 300 ms delay issue?).
It's also important to notice that Ionic components were designed/implemented according to each platform's design guidelines and recommended patterns. Users expect all apps to respect some UI/UX patterns they are already used to, and Ionic does that extremely well.
Last but not least, some components also encapsulates a lot of logic that would be kind of hard to be implemented with just html elements (for example, the ion-item-sliding component).
But please notice that there're some scenarios where using standard html may be a good option. For example, if you need to show a very long list of items, using ion-items would mean that a new instance of the ion-item component is created for each item of the list, and your Ionic app will need to keep them in memory. Ionic components were implemented to be very performant so this won't be an issue for most of the mobile devices nowadays, but if you need to support old/slow devices this may improve the performance a lot.

GWT approach for mobile

I need to develop a gwt app that requires support on desktop, mobile, tablet. I need to choose whether to use m-gwt or stick to the approach presented in Google IO 2011
Google IO 2011 approach seems to be -
1) create different views for different screen sizes
2) use deferred binding load only the relevant views according to the user agent
3) same presenter code
IO 2011 approach seems much simpler to me (and not tied with activities and places) but I am not sure if this approach is still popular and will work.
Can someone please let me know the pros and cons of these two approaches ?
Regards,
Sathya
You are mistaken in the assumption that mgwt is tied to Activities & Places, you can use it without using them. If you like using Activities and Places mgwt works of course very well.
The approach presented at Google I/O is actually quite similiar on what mgwt does.
If you are looking into building one application for phone, tablet and desktop from one code base here is an interesting read: http://fahnenbruck.blogspot.de/2014/02/running-on-any-platform-using-java-with.html

Implementing an app with multiple views in GWT

I understand from threads in this forum and the Google GWT forum that in the GWT world you typically load just a single page and then what appears to a user to be a different page is just the same page with it's content being updated by user actions. A lot of posts imply that you develop your app as you would a desktop application. That sounds easy if you have done desktop development but I am coming from a pure Web services/ Servlets/ Struts background and want to see a very basic example that shows the proper way to implement a GWT app where you show a user a txt box and button and when they click the button, the view is replaced with 2 different components.
There are plenty of basic apps I have done and plenty of complex multipage type ones but I just one that takes me past the click a button to see a message type app to the next level.
Any links to such an example would be welcome
I recommend to study Activities & Places design pattern. It is the best approach, in my view, for large applications with multiple views. It provides a lot of important functionality "out of the box", like browser history management, support for tokens, efficient memory management, etc.
You may want to look into the Model-View-Presenter pattern (MVP). Using this pattern correctly will greatly decouple your application, allowing you to create views that are not only highly modular and disposable, but are very easy to swap out and change.
In fact, Google fully recommends the MVP pattern when developing GWT applications. They provide a full example and walkthrough of a MVP GWT application here, which I imagine is based off of a Google I/O presentation given on best GWT application architecture practices back in 2009.
I've been following this pattern with my latest GWT project and it's working out extremely well. It's very easy to add, remove and swap views.