How to Show App Back Button in Flutter

The sample code below shows how to display app back button in flutter.

The code is based on Flutter version 1.0.0.


This is the main entry point of the application.

import 'package:flutter/material.dart';
import 'appbar_back_1.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        // This is the theme of your application.
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
      //home: MyHomePage(title: 'Flutter Demo Home Page'),
      home: AppBarBack(),

In the code above, we have imported appbar_back_1.dartwhich represents the page that will show flutter back button when the application is run in android device or emulator.


import 'package:flutter/material.dart';

class AppBarBack extends StatelessWidget {
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        automaticallyImplyLeading: true,
        //`true` if you want Flutter to automatically add Back Button when needed,
        //or `false` if you want to force your own back button every where
        title: Text('AppBar Back Button'),
        leading: IconButton(icon:Icon(Icons.arrow_back),
          onPressed:() => Navigator.pop(context, false),
      body: Center(
        child: Text("Main Screen"),

flutter app back button

If you have any questions or suggestions kindly use the comment box or you can contact us directly through our contact page below.



  1. Avatar
  2. Avatar
  3. Avatar

Add a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.