Skip to main content

Flutter Web Application Development with and setting the path url strategy

Web Application Development with Flutter 

Flutter 2.0 is now live and the creation of the web application using Flutter is now fully supported. In this blog post, we are going to create a web application using Flutter and Navigator 2.0.

Create Web Application Project 

For creating the web application using you need to install  2.0 or a later version of the Flutter. You check the version of the dart and Flutter using the below command.

flutter --version
Flutter 2.0.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 1d9032c7e1 (2 weeks ago) • 2021-04-29 17:37:58 -0700
Engine • revision 05e680e202
Tools • Dart 2.12.3

You can follow the steps mention on flutter.dev getting started page to configure the web application. For this post, I am going to create a simple web application that will show the route name in the browser as we change the view in the apps. Let's give the project a name web navigator demo.

Step1:- Create a Web Application using Android Studio

Open the Android Studio and tab on File -> New Flutter Project It will open the below Window as per the latest android studio version 4.2.1

Choose Flutter App and tab on next:-

If you want to create only for the Web then untick the Android and iOS option in the above window and give the name to project and tab on Finish. It will create a project with basic code in it.

For testing the web application just select the browser and tab on run, first time it will take some time to complete the compilation and then launch the application in the separate Chrome tab.


How to remove the # in the Url of the web application in Flutter

For removing the # from the URL pattern we have two options.

Option 1:  Configure the URL strategy as advised in the Flutter document
Add the following in the pubspec.yaml file and set the path into your main.dart file before the runApp().
dependencies:
flutter:
sdk: flutter
flutter_web_plugins:
sdk: flutter

void main() {
setUrlStrategy(PathUrlStrategy());
runApp(MyApp());
}
Option2: If you don't want to use the flutter_web_plugin then add the url_strategy package and add the below code in main.dart file before runApp() like given below.
void main() {
  // Here we set the URL strategy for our web app.
  // It is safe to call this function when running on mobile or desktop as well.
  setPathUrlStrategy();
  runApp(MyApp());
}

Thanks for visiting the page, will continue on this Web application and the next post will share the routing of the web application with Navigator 2.0


Comments

  1. Buen trabajo, esta es información esencial que usted comparte. Esta información es significativa y muy importante para que podamos aumentar nuestro conocimiento al respecto. Siempre sigue compartiendo este tipo de información. Gracias una vez más por compartirlo. APLICACIONES MOBILES

    ReplyDelete
  2. Android Mobile App Design ​Agency. We Design Android Apps That Leave A Lasting Impression. Designing Android apps is one of our specialties For more details call now!@ +91-120-4273676.
    ​Visit-

    android mobile app development company

    ReplyDelete
  3. I just need to say this is a well-informed article which you have shared here about hoodies.web development company in pune It is an engaging and gainful article for us. Continue imparting this sort of info, Thanks to you.

    ReplyDelete
  4. Thanks for your post. It's very helpful post for us. You can also visit web development company in dubai for more Victor Steel related information. I would like to thanks for sharing this article here.

    ReplyDelete
  5. You wrote this post very carefully.Web Development Ontario The amount of information is stunning and also a gainful article for us. Keep sharing this kind of articles, Thank you.

    ReplyDelete
  6. You wrote this post very carefully.Web Development Services The amount of information is stunning and also a gainful article for us. Keep sharing this kind of articles, Thank you.

    ReplyDelete
  7. Thanks for sharing this article here about the Web & Technology. Your article is very informative and I will share it with my other friends as the information is really very useful. Keep sharing your excellent work.Social Media Marketing Services USA site.

    ReplyDelete
  8. You wrote this post very carefully. The amount of information is stunning and also a gainful article for us. Keep sharing this kind of articles,web agency Jakarta Thank you.

    ReplyDelete
  9. I will be honest it is the most useful tip I have read till date. Thanks for putting all this together.
    I am really positive using your thoughts and knowledge will help me to improve my flutter app development .
    Great work. Keep doing great work for us. Loved it

    ReplyDelete
  10. I read the above article and I got some knowledge from your article. It's actually great and useful data for us. Thanks for share it.Logo Design Services in Fort St John

    ReplyDelete
  11. I read your post and got it quite informative. I couldn't find any knowledge on this matter prior to. I would like to thanks for sharing this article here. iOS App Development Company

    ReplyDelete
  12. Thanks for publishing such excellent knowledge. You are doing such a good job. This info is very helpful for everyone. Keep it up. Thanks. Read more info about design sprint process in India

    ReplyDelete
  13. Thanks for sharing this kind of information about Flutter App Development.

    ReplyDelete
  14. You have shared a lot of information in this article. I would like to express my gratitude to everyone who contributed to this useful article. Keep posting. app development company dubai

    ReplyDelete
  15. Content is a website's most crucial component. Your website is little more than an advertising without content, making it ineffective for online marketing. Any marketing expert who builds websites should constantly aim to provide users with an online resource. Best web design agency in vizag
    The most popular websites on the internet have the most material, despite how obvious it may sound.
    Whatever your business or organisation offers, your main objective should be to empower your customers rather than just trying to sell them anything; that will happen in due course. By demonstrating that you care about their interests, you give them a reason to come back, which raises the possibility that they will make a purchase or many purchases.

    ReplyDelete
  16. Writing a post is really important for the growth of your websites. Thanks for sharing amazing tips about DIY Credit Repair Software. Following these steps will transform the standard of your post for sure.

    ReplyDelete

Post a Comment

Popular posts from this blog

Flutter How to Start Android Activity from Flutter View

Flutter and Dart is an excellent combination for creating the UI, but for accessing the platform-specific service we need to open platform-specific activity. So lets in this article we will explore how to start an android activity and access the service from Flutter View. Create a Project for this Android Activity Flutter View Demo Create a Project From File menu select the New Flutter Project Enter the project name Select the AndroidX support and click on next After the above, we step click on Finish We will have the following project structure created. Create the Second Activity in Android Just go to the android folder and open it in separate windows. We will have the following project structure. Create the Activity Just right-click on the Kotlin folder and create a blank activity from the menu. If you create the activity then you may be required to upgrade the Gradle and do some import. So Just click on update and wait for the project s

WordPress Android App with REST API And Retrofit

Retrofit is the library which converts your JSON data into Java object. In this tutorial, we will learn about how to implement the Retrofit to create a WordPress Mobile App. As we all know, WordPress is the one of the biggest CMS (Content Management System) of the world. Wordpress full fill the requirements for all most every type of the website. So, in this tutorial, I am going to learn how to create an Android App using the WordPress REST API and Retrofit. What is Retrofit? If you want to know about Retrofit, I would like to give you just a simple one-line explanation of the Retrofit. It is a library which converts your REST HTTP request to Java interface. We will learn how we can do all these stuff using some very simple steps. Further, you can check the Retrofit Library here . So, In this tutorial, we will use the Retrofit to retrieve all post and there except ( A short Description of Post) form a WordPress website. Prerequisite for using the Retrofit for WordPress Android App Ther

Kotlin Parcelable Array Objects Send To Activity

We know that IPC (Inter Process Communication) between the activity is an extremely important part of any application development. We often required that we need to send some data to other activity. For example, we may be required to send an array of data, data could be an Integer, String, Long, Double, Float or any other custom data objects. So, In this example, we are going to learn how to implement the Kotlin Parcelable Array object to send the data from one activity to second activity. What is Parcel? The parcel class is designed as a high-performance IPC transport. A Parcel can contain both flattened data that will be unflattened on the other side of the IPC, and references to live IBinde r objects that will result in the other side receiving a proxy IBinder connected with the original IBinder in the Parcel. Create Kotlin Parcelable Array Objects Parcelable is API for placing the arbitrary objects into the Parcel. In Actual in android app development, Parcelable is an interface