How to create Toast in Flutter

0 votes

Hi Guys,

I want to create a Toasts in Flutter. Whenever I will submit something it will pop up automatically. How can I do that?

Jul 27, 2020 in Others by akhtar
• 38,170 points
268 views

1 answer to this question.

0 votes

Hi@akhtar,

You can use the toast plugin to create this. You need to install the toast package from the below link.

https://pub.dev/packages/fluttertoast

After that import the package in your flutter code.

import 'package:fluttertoast/fluttertoast.dart';

Now finally add these below lines in your code.

  Fluttertoast.showToast(
      msg: "This is Center Short Toast",
      toastLength: Toast.LENGTH_SHORT,
      gravity: ToastGravity.BOTTOM_LEFT,
      timeInSecForIosWeb: 1,
      backgroundColor: Colors.red,
      textColor: Colors.white,
      fontSize: 16.0);

When you run your code will can see the below output.

answered Jul 27, 2020 by MD
• 95,040 points

Related Questions In Others

0 votes
1 answer

How to create a Volume Icon in Flutter App?

Hi@akhtar, You can use Icon Widget to create ...READ MORE

answered Jul 24, 2020 in Others by MD
• 95,040 points
285 views
0 votes
1 answer

How to create a container widget in Flutter?

Hi@akhtar, Container means a parent widget that contains ...READ MORE

answered Jul 28, 2020 in Others by MD
• 95,040 points
171 views
0 votes
1 answer

How to create an input field in Flutter?

Hi@akhtar, There are different ways to create an ...READ MORE

answered Aug 9, 2020 in Others by MD
• 95,040 points
127 views
0 votes
1 answer

How to create a FlatButton in Flutter?

Hi@akhtar, A flat button is a text label ...READ MORE

answered Aug 12, 2020 in Others by MD
• 95,040 points
86 views
0 votes
1 answer

What is pubspec.yaml file in Flutter?

Hi@akhtar, It is the project's configuration file that ...READ MORE

answered Jul 20, 2020 in Others by MD
• 95,040 points
679 views
0 votes
1 answer

Error: No pubspec.yaml file found.

Hi@akhtar, You need to run this command from ...READ MORE

answered Jul 20, 2020 in Others by MD
• 95,040 points
2,430 views
0 votes
1 answer

How to launch an emulators from Flutter?

Hi@akhtar, Before launching emulators you should check if ...READ MORE

answered Jul 20, 2020 in Others by MD
• 95,040 points
1,191 views
0 votes
1 answer

How to create a Project in Flutter?

Hi@akhtar, Flutter has an inbuilt command to create ...READ MORE

answered Jul 20, 2020 in Others by MD
• 95,040 points
122 views
0 votes
1 answer

How to create an Icon Button in Flutter?

Hi@akhtar, To create an Icon Button in Flutter, ...READ MORE

answered Jul 24, 2020 in Others by MD
• 95,040 points
134 views