{"id":89426,"date":"2024-09-16T18:00:40","date_gmt":"2024-09-16T12:30:40","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=89426"},"modified":"2024-09-16T11:32:49","modified_gmt":"2024-09-16T06:02:49","slug":"flutter-hangman-game-project","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/flutter-hangman-game-project\/","title":{"rendered":"Flutter Project &#8211; Hangman Game"},"content":{"rendered":"<p>Hangman is a classic word-guessing game that is often played to test vocabulary and word-solving skills. It is popular with children and adults and can be enjoyed in various settings.<\/p>\n<p>Hangman is a word-guessing game in which one player thinks of a word, and the other tries to guess it letter by letter. The guesser has a limited number of incorrect guesses before a hangman figure is fully drawn. The objective is for the guesser to guess the word correctly while avoiding the completion of the hangman figure. The game is both fun and educational, testing vocabulary and deduction skills.<\/p>\n<h2>About Flutter Hangman Game<\/h2>\n<p>In this Flutter Hangman Game Project, we will build the Hangman game in Flutter. We will implement the game&#8217;s rules, build the game&#8217;s UI, interact with users, and learn about various widgets used in building the app. By the end of this Project, you&#8217;ll have a fully functional Flutter-based Hangman app that you can use and customize as you see fit.<\/p>\n<h3>Prerequisites For Flutter Hangman Game<\/h3>\n<p><strong>To start working on Flutter, first, let\u2019s install the below-mentioned required software to build the app:<\/strong><\/p>\n<p><strong>(i) Flutter &#8211;<\/strong> I<span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\">nstall<\/span>\u00a0<a href=\"https:\/\/docs.flutter.dev\/get-started\/install\">Flutter<\/a>, depending on your operating system .<br \/>\n<strong>(ii) Android Studio &#8211;<\/strong><a href=\"https:\/\/developer.android.com\/studio\/install\"> Android Studio<\/a> is necessary as it will run the app in the Android emulator.<br \/>\n<strong>(iii) Visual Studio Code<\/strong><span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\"><strong>\u2014<\/strong>Although this is not necessary, you can also build apps in Android Studio. In our case, we have used\u00a0<a href=\"https:\/\/code.visualstudio.com\/download\" target=\"_blank\" rel=\"noopener\">VS Code<\/a><\/span>\u00a0as it is a good code editor.<\/p>\n<p>Now that the setup is ready, let\u2019s get started!<\/p>\n<h3>Download Flutter Hangman Game Project<\/h3>\n<p>Please download the source code of Flutter Hangman Game Project: <strong><a href=\"https:\/\/techvidvan.s3.amazonaws.com\/Flutter-projects\/hangman-game.zip\">Flutter Hangman Game Project Code<\/a>.<\/strong><\/p>\n<h3>Creating New Flutter Hangman Game Project<\/h3>\n<p>Let\u2019s start with creating a new Flutter Hangman Game Project through the Flutter terminal. Go to the directory where you want to save the project using:-<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">cd  $Project-directory-path<\/pre>\n<p>Then create a new project using the below command:-<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">flutter create hangman<\/pre>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/11\/Creating-New-Flutter-Project.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-89635 size-full\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/11\/Creating-New-Flutter-Project.webp\" alt=\"Creating New Flutter Project\" width=\"437\" height=\"86\" \/><\/a><\/p>\n<h3>Changes in the pubsec.yaml file<\/h3>\n<p>We are using images in our app to display the stages of the hangman. In Flutter, we need to specify these assets(images in our case) in our pubsec.yaml file. In the file, under the assets section, you can add the images we are using with their specific path to the image files. You can see the changes in the below image.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/11\/Changes-in-the-pubsec.yaml-file.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-89636\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/11\/Changes-in-the-pubsec.yaml-file.webp\" alt=\"Changes in the pubsec yaml file\" width=\"1283\" height=\"867\" \/><\/a><\/p>\n<h3>Steps to Build Flutter Hangman Game<\/h3>\n<h4>1. Creating the Logic for Hangman Game<\/h4>\n<p>Before building the UI of the app, let\u2019s write the code for the logic of the app. Here we defined a few variables like hanged, which is total number of guesses; _wrongGuesses, which is the number of wrong guesses by the player, wordList which is the list of words that will be used to guess in the game, letterGuessed, which will store the set of letters that the player has guessed. We have also initialized several StreamController, which will be used to listen to various events such as _onWin, _onLose, _onWrong, _onRight, _onChange.<\/p>\n<p>Other that this, we have created several functions which we will use for the logic of the app. These functions are:-<\/p>\n<p><strong>(i) newGame &#8211;<\/strong> This help intitalizing a new game where a new word will be selected from the list, variables like _wrongGuesses and lettersGuesses will be reseted<br \/>\n<strong>(ii) guessLetter &#8211;<\/strong> This function will be executed as the player selects a letter. It will add the letter in lettersGuessed set and check if the letter is present in the word. It will check for the win, and if the letter is not in the word, it will check for a lose and update the variables accordingly.<br \/>\n<strong>(iii) isWordComplete &#8211;<\/strong> It checks if the player has guessed all the letters of the word.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import 'dart:async';\r\n\r\nclass HangmanGame {\r\n  static const int hanged =\r\n      7; \/\/ number of wrong guesses before the player's demise\r\n\r\n  final List&lt;String&gt; wordList; \/\/ list of possible words to guess\r\n  final Set&lt;String&gt; lettersGuessed = Set&lt;String&gt;();\r\n\r\n  List&lt;String&gt; _wordToGuess = []; \/\/ Made changes here\r\n  int _wrongGuesses = 0; \/\/ Made changes here\r\n\r\n  StreamController&lt;Null&gt; _onWin = new StreamController&lt;Null&gt;.broadcast();\r\n  Stream&lt;Null&gt; get onWin =&gt; _onWin.stream;\r\n\r\n  StreamController&lt;Null&gt; _onLose = new StreamController&lt;Null&gt;.broadcast();\r\n  Stream&lt;Null&gt; get onLose =&gt; _onLose.stream;\r\n\r\n  StreamController&lt;int&gt; _onWrong = new StreamController&lt;int&gt;.broadcast();\r\n  Stream&lt;int&gt; get onWrong =&gt; _onWrong.stream;\r\n\r\n  StreamController&lt;String&gt; _onRight = new StreamController&lt;String&gt;.broadcast();\r\n  Stream&lt;String&gt; get onRight =&gt; _onRight.stream;\r\n\r\n  StreamController&lt;String&gt; _onChange = new StreamController&lt;String&gt;.broadcast();\r\n  Stream&lt;String&gt; get onChange =&gt; _onChange.stream;\r\n\r\n  \/\/ ignore: unnecessary_new\r\n  HangmanGame(List&lt;String&gt; words) : wordList = new List&lt;String&gt;.from(words);\r\n\r\n  void newGame() {\r\n    \/\/ shuffle the word list into a random order\r\n    wordList.shuffle();\r\n\r\n    \/\/ this extracts the first word from the random list of words\r\n    _wordToGuess = wordList.first.split('');\r\n\r\n    \/\/ reset the wrong guess count\r\n    _wrongGuesses = 0;\r\n\r\n    \/\/ it clears the lettersGuessed set\r\n    lettersGuessed.clear();\r\n\r\n    \/\/ declare the change (new word)\r\n    _onChange.add(wordForDisplay);\r\n  }\r\n\r\n  void guessLetter(String letter) {\r\n    \/\/ store guessed letter\r\n    lettersGuessed.add(letter);\r\n\r\n    \/\/ it checks if the user has won if letter in the word\r\n    \/\/ otherwise, check for player death\r\n    if (_wordToGuess.contains(letter)) {\r\n      _onRight.add(letter);\r\n\r\n      if (isWordComplete) {\r\n        _onChange.add(fullWord);\r\n        _onWin.add(null);\r\n      } else {\r\n        _onChange.add(wordForDisplay);\r\n      }\r\n    } else {\r\n      _wrongGuesses++;\r\n\r\n      _onWrong.add(_wrongGuesses);\r\n\r\n      if (_wrongGuesses == hanged) {\r\n        _onChange.add(fullWord);\r\n        _onLose.add(null);\r\n      }\r\n    }\r\n  }\r\n\r\n  int get wrongGuesses =&gt; _wrongGuesses;\r\n  List&lt;String&gt; get wordToGuess =&gt; _wordToGuess;\r\n  String get fullWord =&gt; wordToGuess.join();\r\n\r\n  String get wordForDisplay =&gt; wordToGuess\r\n      .map((String letter) =&gt; lettersGuessed.contains(letter) ? letter : \"_\")\r\n      .join();\r\n\r\n  \/\/ check if all letters in the word are selected by the plsyer\r\n  bool get isWordComplete {\r\n    for (String letter in _wordToGuess) {\r\n      if (!lettersGuessed.contains(letter)) {\r\n        return false;\r\n      }\r\n    }\r\n\r\n    return true;\r\n  }\r\n}<\/pre>\n<h4>2. Starting with the Main Layout of the App<\/h4>\n<p>Now that we know the logic of the app, let\u2019s start building the UI of the app. We have imported the material.dart package from Flutter to use the widgets, which will help in building the UI components. We have also imported the hangman logic file which we created in the previous section, and another home_page file, which we will see in the next section.<\/p>\n<p>We have initialized a list of words to be used in the game, game logic which we will use, and color scheme by the variable kColorScheme which we will use to define the theme of the app.<\/p>\n<p>In the MaterialApp, we define theme using ThemeData and use the color scheme defined in the variable. We also define background and foreground color for appBarTheme. In the home, we return the Scaffold widget in which we have an AppBar, and in the body, we return the Home Page which we will create in the next section.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import 'package:flutter\/material.dart';\r\n\r\nimport '.\/home_page.dart';\r\nimport '.\/engine\/hangman_logic.dart';\r\n\r\nconst List&lt;String&gt; wordList = [\r\n  \"PLENTY\",\r\n  \"ACHIEVE\",\r\n  \"CLASS\",\r\n  \"STARE\",\r\n  \"AFFECT\",\r\n  \"THICK\",\r\n  \"CARRIER\",\r\n  \"BILL\",\r\n  \"SAY\",\r\n  \"ARGUE\",\r\n  \"OFTEN\",\r\n  \"GROW\",\r\n  \"VOTING\",\r\n  \"SHUT\",\r\n  \"PUSH\",\r\n];\r\n\r\nColorScheme kColorScheme =\r\n    ColorScheme.fromSeed(seedColor: const Color.fromARGB(255, 239, 221, 179));\r\nHangmanGame gameLogic = HangmanGame(wordList);\r\nvoid main() {\r\n  runApp(MaterialApp(\r\n    theme: ThemeData(\r\n      colorScheme: kColorScheme,\r\n      appBarTheme: const AppBarTheme().copyWith(\r\n          backgroundColor: kColorScheme.onPrimaryContainer,\r\n          foregroundColor: kColorScheme.primaryContainer),\r\n    ),\r\n    home: Scaffold(\r\n      appBar: AppBar(\r\n        title: const Text('Hangman (By TechVidvan)'),\r\n      ),\r\n      body: HomePage(\r\n        logic: gameLogic,\r\n      ),\r\n    ),\r\n  ));\r\n}<\/pre>\n<h4>3. Creating the Home Page<\/h4>\n<p>We have created the custom widget Home Page to show the main content of the page which is a Stateful widget as the UI of the app needs to be rendered again with user interaction. Here we initialize variables like victoryImage which refers to the path of the victory image, currentImageState that is used to show which stage of hangman image will be displayed on the screen, alphabets which is a list from A-Z, showNewGame which is a boolean variable that tells whether the button New Game should be displayed on the page or not and currentWord variable which is the word that user types.<\/p>\n<p>We have also created functions which will be used as the user interact with the game. These functions are updateActiveWord which updates the currentWord as user types, updateHangmanImage which update the hangman image depending on the stage of game, _gameOver which is used to update _showNewGame variable, _win which executes when user wins the game and _newGame which again initializes all the variables from the start.<\/p>\n<p>In the initState, we use various listeners which we created in the hangman_logic file to execute the functions we defined in case there is any change or user selects the wrong letter or if user wins or loses the game.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import 'package:flutter\/material.dart';\r\n\r\nimport 'package:hangman\/engine\/hangman_logic.dart';\r\nimport '.\/widgets\/bottom_content.dart';\r\n\r\nclass HomePage extends StatefulWidget {\r\n  const HomePage({super.key, required this.logic});\r\n  final HangmanGame logic;\r\n  @override\r\n  State&lt;HomePage&gt; createState() {\r\n    return _HomePageState();\r\n  }\r\n}\r\n\r\nclass _HomePageState extends State&lt;HomePage&gt; {\r\n  final String victoryImage = 'assets\/images\/hangman_8.png';\r\n  int currentImageState = 0;\r\n\r\n  final List&lt;String&gt; alphabets = [\r\n    'A',\r\n    'B',\r\n    'C',\r\n    'D',\r\n    'E',\r\n    'F',\r\n    'G',\r\n    'H',\r\n    'I',\r\n    'J',\r\n    'K',\r\n    'L',\r\n    'M',\r\n    'N',\r\n    'O',\r\n    'P',\r\n    'Q',\r\n    'R',\r\n    'S',\r\n    'T',\r\n    'U',\r\n    'V',\r\n    'W',\r\n    'X',\r\n    'Y',\r\n    'Z'\r\n  ];\r\n\r\n  late bool _showNewGame = false;\r\n  late String _currentWord = '';\r\n\r\n  @override\r\n  void initState() {\r\n    super.initState();\r\n\r\n    widget.logic.onChange.listen(_updateActiveWord);\r\n    widget.logic.onWrong.listen(_updateHangmanImage);\r\n    widget.logic.onWin.listen(_win);\r\n    widget.logic.onLose.listen(_gameOver);\r\n\r\n    _newGame();\r\n  }\r\n\r\n  void _updateActiveWord(String word) {\r\n    setState(() {\r\n      _currentWord = word;\r\n    });\r\n  }\r\n\r\n  void _updateHangmanImage(int wrongGuessCount) {\r\n    setState(() {\r\n      currentImageState = wrongGuessCount;\r\n    });\r\n  }\r\n\r\n  void _gameOver(Null) {\r\n    setState(() {\r\n      _showNewGame = true;\r\n    });\r\n  }\r\n\r\n  void _win(Null) {\r\n    setState(() {\r\n      currentImageState = 8;\r\n      _gameOver(Null);\r\n    });\r\n  }\r\n\r\n  void _newGame() {\r\n    widget.logic.newGame();\r\n\r\n    setState(() {\r\n      currentImageState = 0;\r\n      _currentWord = '';\r\n      _showNewGame = false;\r\n    });\r\n  }<\/pre>\n<p>In the build function, we return the content of the page, which is shown using the Column widget, which is contained in a container. In the column widget\u2019s children argument, we return the Image of the current stage of hangman wrapped in the Expanded widget so that the image takes as much space as possible, Text widget to show the currentWord typed by the user which has been given padding using the padded widget and a custom widget, BottomContent which we will create in the next section. The BottomContent widget is also wrapped around the Expanded widget, so it should take as much space as available.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">@override\r\n  Widget build(BuildContext context) {\r\n    return Container(\r\n      alignment: Alignment.center,\r\n      width: double.infinity,\r\n      height: double.infinity,\r\n      child: Column(\r\n        children: [\r\n          Expanded(\r\n            child: Image.asset('assets\/images\/hangman_$currentImageState.png'),\r\n          ),\r\n          Padding(\r\n            padding: const EdgeInsets.all(20),\r\n            child: Text(\r\n              _currentWord,\r\n              style: const TextStyle(fontSize: 30, letterSpacing: 5.0),\r\n            ),\r\n          ),\r\n          Expanded(\r\n              child: Center(\r\n            child: BottomContent(\r\n              alphabets: alphabets,\r\n              displayNewGame: _showNewGame,\r\n              newGame: _newGame,\r\n              userLettersGuessed: widget.logic.lettersGuessed,\r\n              guessLetter: widget.logic.guessLetter,\r\n            ),\r\n          ))\r\n        ],\r\n      ),\r\n    );\r\n  }\r\n}<\/pre>\n<h4>4. Helper Widgets Used in the App<\/h4>\n<p>Here below we have created a custom widget, BottomContent, which is a stateless widget. It is used to display the bottom content of the page. In the constructor function, we accept various arguments that we will use while building the widget.<\/p>\n<p>The content is displayed on the basis of the displayNewGame parameter, which we accept as an argument in the constructor function.<\/p>\n<p>If the variable is true, then we display the TextButton for the NewGame; otherwise, if it is false, we display the TextButton for letters from A-Z using the Wrap Widget, which displays the content row-wise and, if needed, uses the next row. While pressing the letter, it checks if the letter has already been guessed, and then nothing executes; else, it\u00a0executes the guessLetter function defined in the hangman logic.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import 'package:flutter\/material.dart';\r\n\r\nclass BottomContent extends StatelessWidget {\r\n  const BottomContent(\r\n      {super.key,\r\n      required this.displayNewGame,\r\n      required this.alphabets,\r\n      required this.newGame,\r\n      required this.userLettersGuessed,\r\n      required this.guessLetter});\r\n\r\n  final bool displayNewGame;\r\n  final List&lt;String&gt; alphabets;\r\n  final Function() newGame;\r\n  final Set&lt;String&gt; userLettersGuessed;\r\n  final Function(String) guessLetter;\r\n  @override\r\n  Widget build(BuildContext context) {\r\n    if (displayNewGame) {\r\n      return TextButton(\r\n        onPressed: newGame,\r\n        child: const Text(\r\n          'New Game',\r\n          style: TextStyle(fontSize: 24),\r\n        ),\r\n      );\r\n    } else {\r\n      Set&lt;String&gt; lettersGuessed = userLettersGuessed;\r\n      return Padding(\r\n        padding: const EdgeInsets.all(3.0),\r\n        child: Wrap(\r\n          spacing: 12,\r\n          runSpacing: 3,\r\n          alignment: WrapAlignment.center,\r\n          children: alphabets\r\n              .map(\r\n                (letter) =&gt; TextButton(\r\n                  style: TextButton.styleFrom(\r\n                    side: const BorderSide(width: 1.0),\r\n                    textStyle: const TextStyle(\r\n                        fontSize: 18, fontWeight: FontWeight.bold),\r\n                    padding: const EdgeInsets.all(2.0),\r\n                  ),\r\n                  onPressed: lettersGuessed.contains(letter)\r\n                      ? null\r\n                      : () {\r\n                          guessLetter(letter);\r\n                        },\r\n                  child: Text(letter),\r\n                ),\r\n              )\r\n              .toList(),\r\n        ),\r\n      );\r\n    }\r\n  }\r\n}<\/pre>\n<h3>Flutter Hangman Game Output<\/h3>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/11\/Flutter-Hangman-Game-output-.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-89637\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/11\/Flutter-Hangman-Game-output-.webp\" alt=\"Flutter Hangman Game output\" width=\"400\" height=\"722\" \/><\/a><\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/11\/Flutter-Hangman-Game-.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-89638\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/11\/Flutter-Hangman-Game-.webp\" alt=\"Flutter Hangman Game \" width=\"400\" height=\"747\" \/><\/a><\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/11\/output-Flutter-Hangman-Game-.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-89639\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/11\/output-Flutter-Hangman-Game-.webp\" alt=\"output Flutter Hangman Game\" width=\"400\" height=\"720\" \/><\/a><\/p>\n<h3>Conclusion<\/h3>\n<p>This Flutter Hangman Game Project included many interesting widgets and the logic of the app. We learned about widgets like Wrap, which we used to show the letters and images; Assets, which we used to show the stages of the Hangman image; Expanded widgets; and how to use StreamControllers to listen to various events.<\/p>\n<p>We also learned about what changes to do in pubsec.yaml file while using images in your project using .assets property of Image widget. We built various functions to implement the logic of the app.<\/p>\n<p>I hope you enjoyed working on this project!<br \/>\nThank you for reading! Keep Learning Flutter!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hangman is a classic word-guessing game that is often played to test vocabulary and word-solving skills. It is popular with children and adults and can be enjoyed in various settings. Hangman is a word-guessing&#46;&#46;&#46;<\/p>\n","protected":false},"author":6,"featured_media":447275,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5557],"tags":[5621,5542,5543,430,431,432,433,5539,5674,5673],"class_list":["post-89426","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-flutter-tutorials","tag-create-hangman-game-using-flutter","tag-flutter","tag-flutter-hangman-game","tag-flutter-hangman-game-project","tag-flutter-project-for-beginners","tag-flutter-project-for-practice","tag-flutter-project-ideas","tag-flutter-projects","tag-hangman-game","tag-hangman-game-using-flutter"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Flutter Project - Hangman Game - TechVidvan<\/title>\n<meta name=\"description\" content=\"In this Flutter Hangman Game Project, we learned about widgets like Wrap, which we used to display the letters and Images.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/flutter-hangman-game-project\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Flutter Project - Hangman Game - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"In this Flutter Hangman Game Project, we learned about widgets like Wrap, which we used to display the letters and Images.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/flutter-hangman-game-project\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-09-16T12:30:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/11\/hangman-game.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Flutter Project - Hangman Game - TechVidvan","description":"In this Flutter Hangman Game Project, we learned about widgets like Wrap, which we used to display the letters and Images.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/techvidvan.com\/tutorials\/flutter-hangman-game-project\/","og_locale":"en_US","og_type":"article","og_title":"Flutter Project - Hangman Game - TechVidvan","og_description":"In this Flutter Hangman Game Project, we learned about widgets like Wrap, which we used to display the letters and Images.","og_url":"https:\/\/techvidvan.com\/tutorials\/flutter-hangman-game-project\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2024-09-16T12:30:40+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/11\/hangman-game.webp","type":"image\/webp"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/flutter-hangman-game-project\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/flutter-hangman-game-project\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/dde481bb412350cde1ed6e389bc0deaf"},"headline":"Flutter Project &#8211; Hangman Game","datePublished":"2024-09-16T12:30:40+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/flutter-hangman-game-project\/"},"wordCount":1366,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/flutter-hangman-game-project\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/11\/hangman-game.webp","keywords":["create hangman game using flutter","flutter","flutter hangman game","flutter hangman game project","flutter project for beginners","flutter project for practice","flutter project ideas","flutter projects","hangman game","hangman game using flutter"],"articleSection":["Flutter Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/flutter-hangman-game-project\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/flutter-hangman-game-project\/","url":"https:\/\/techvidvan.com\/tutorials\/flutter-hangman-game-project\/","name":"Flutter Project - Hangman Game - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/flutter-hangman-game-project\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/flutter-hangman-game-project\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/11\/hangman-game.webp","datePublished":"2024-09-16T12:30:40+00:00","description":"In this Flutter Hangman Game Project, we learned about widgets like Wrap, which we used to display the letters and Images.","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/flutter-hangman-game-project\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/flutter-hangman-game-project\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/flutter-hangman-game-project\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/11\/hangman-game.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/11\/hangman-game.webp","width":1200,"height":628,"caption":"hangman game"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/flutter-hangman-game-project\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Flutter Project &#8211; Hangman Game"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/dde481bb412350cde1ed6e389bc0deaf","name":"TechVidvan Team"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/89426","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=89426"}],"version-history":[{"count":4,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/89426\/revisions"}],"predecessor-version":[{"id":447715,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/89426\/revisions\/447715"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/447275"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=89426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=89426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=89426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}