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. Your content is very unique and understandable, useful for the readers to keep updating more articles like this.website developers India

    ReplyDelete
  13. 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
  14. Great tips and very easy to understand. This will definitely be very useful for me when I get a chance to start my blog. PHP Development Company

    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

How to Read and Write JSON data in Kotlin with GSON

Kotlin is now official language for Android development and it is well supported in Android Studio. So here in this tutorial, we are going to learn about how to read and write JSON data in Kotlin using GSON. If you would like to learn the java version of this tutorial check out the last tutorial " How to Read and Write JSON data using GSON ". Introduction In this tutorial, we will write two methods. In the first method, we will create a JSON file and in second method we will read the file and print in a text box.  If you like to know more about the basic entity of JSON you can check out Basic JSON entity here . What is JSON? JSON stands for J ava S cript O bject N otation JSON is a lightweight data-interchange format It is "self-describing" and easy to understand JSON is language independent and can we used in any language JSON Syntax Rules Data is in name/value pairs Data is separated by commas Curly braces hold objects Square brackets hold