Dart Single-Page Application Architecture
In a single page application architecture, the source code for a single web page loads the entire application. The responsibility of building the user interface and requesting data from the server to populate this user interface is attributed to this source code. The best example of single-page applications includes Google Mail, Google Instant Search, and Google Maps built using Dart programming language.
Single-page applications use a client-side virtual machine to move processing from the server to the client. This makes it easier for the server to respond to more requests because the client-side bears the responsibility of processing involved in building the layout. By using Dart’s HTML libraries to incorporate modern HTML5 browser storage and caching technologies, applications can also cache data in the browser to further improve application performance or allow users to work offline.
Every code in the Dart language has a single entry-point function like in any other programming language, called main( ) that is the first function executed by the Dart virtual machine. Therefore, every source code that defines an application only runs when the ‘main’ function is called, making it reliable. This is the point that makes it differentiable from JavaScript, where definition and execution of a function can take place even while the code is being run using eval( ) or monkey-patching technique. Monkey patching is a technique that allows the addition and modification of the default behaviour of a source code at run time without affecting the source code. This particular feature enables the Dart applications to fit in the single-page architecture because it is sure that your source code will be executed as a single unit of code. The Dart virtual machine uses this architecture technique to increase application start-up time and load the apps more quickly using heap snapshots, making it more efficient than JavaScript applications.