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. 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
  14. 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
  15. 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
  16. You are giving such interesting information. It is great and significant information for us, I genuinely savored the experience of figuring out it. Thankful to you for sharing an article like this.Website Designer Bakersfield, CA

    ReplyDelete
  17. Great idea man thanks for keeping it up all the time. I am very happy to see your standard about Web Hosting For Environmental Permits. Really I appreciate you continuing your work.

    ReplyDelete
  18. Amazing content!
    Thanks for sharing this informative blog. Flutter has really made the mobile app development easy. You can also visit flutter companies to know the list of best companies who are masters in flutter app development.
    keep sharing content like this!

    ReplyDelete
  19. I like your article & will always be coming frequently to read more of your post. Thanks very much for your post once more.
    Flutter Mobile App 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

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

Create Custom EditText View in Android

We use the EditText for taking the input from the user and use it at several places in our project. We required to do lots of customization for each time and there are lots of redundant code we write. Writing and managing these redundant codes is very difficult for example if we want to change the look and feel of the view them we need to modify it at each place where our EditText is getting used. So to avoid these kinds of the problem we can create our own Custom EditText View by just. The EditText view is just an extension of the TextView with lots of editing option and properties that required for the user input. How To Create Custom EditText View For creating the Custom EditText we need to extend the AppCompatEditText and override all three constructors of the view as given below. import android.content.Context; import android.graphics.Typeface; import android.support.annotation.Nullable; import android.support.v7.widget.AppCompatEditText; import android.util.AttributeSet; public