{"id":25926,"date":"2021-12-06T13:08:06","date_gmt":"2021-12-06T13:08:06","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=25926"},"modified":"2021-12-07T09:12:13","modified_gmt":"2021-12-07T09:12:13","slug":"flutter-place_picker-error-the-getter-body1-isnt-defined-for-the-class-texttheme","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/flutter-place_picker-error-the-getter-body1-isnt-defined-for-the-class-texttheme\/","title":{"rendered":"[SOLVED] Flutter Error: The getter &#8216;body1&#8217; isn&#8217;t defined for the class &#8216;TextTheme&#8217; &#8211; place_picker."},"content":{"rendered":"\n<h1 class=\"has-text-align-center wp-block-heading\"><span class=\"has-inline-color has-vivid-red-color\">Error<\/span><\/h1>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">\/C:\/src\/flutter\/.pub-cache\/hosted\/pub.dartlang.org\/place_picker-0.9.19-nullsafety\/lib\/widgets\/rich_suggestion.dart:35:89: Error: The getter \u2018body1\u2019 isn\u2019t defined for the class \u2018TextTheme\u2019.\n\u2013 \u2018TextTheme\u2019 is from \u2018package:flutter\/src\/material\/text_theme.dart\u2019 (\u2018\/C:\/src\/flutter\/packages\/flutter\/lib\/src\/material\/text_theme.dart\u2019).\nTry correcting the name to the name of an existing getter, or defining a getter or field named \u2018body1\u2019.\nTextSpan(text: boldText, style: style.copyWith(color: Theme.of(context).textTheme.body1!.color)),\n^^^^^\n\/C:\/src\/flutter\/.pub-cache\/hosted\/pub.dartlang.org\/place_picker-0.9.19-nullsafety\/lib\/widgets\/search_input.dart:60:65: Error: The getter \u2018body1\u2019 isn\u2019t defined for the class \u2018TextTheme\u2019.\n\u2013 \u2018TextTheme\u2019 is from \u2018package:flutter\/src\/material\/text_theme.dart\u2019 (\u2018\/C:\/src\/flutter\/packages\/flutter\/lib\/src\/material\/text_theme.dart\u2019).\nTry correcting the name to the name of an existing getter, or defining a getter or field named \u2018body1\u2019.\nIcon(Icons.search, color: Theme.of(context).textTheme.body1!.color),\n\n^^^^^\n\nFAILURE: Build failed with an exception.\n\n* Where:\nScript \u2018C:\\src\\flutter\\packages\\flutter_tools\\gradle\\flutter.gradle\u2019 line: 1005\n\n* What went wrong:\nExecution failed for task \u2018:app:compileFlutterBuildDebug\u2019.\n&gt; Process \u2018command \u2018C:\\src\\flutter\\bin\\flutter.bat\u201d finished with non-zero exit v alue 1\n\n* Try:\nRun with \u2013stacktrace option to get the stack trace. Run with \u2013info or \u2013debug option to get more log output. Run with \u2013scan to get full insights.\n\n* Get more help at https:\/\/help.gradle.org\n\nBUILD FAILED in 42s\nException: Gradle task assembleDebug failed with exit code 1\nExited (sigterm)<\/code><\/span><\/pre>\n\n\n<h1 class=\"has-text-align-center wp-block-heading\"><span class=\"has-inline-color has-vivid-red-color\">SOLUTION<\/span><\/h1>\n\n\n\n<p>Here is what I found on StackOverflow<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"721\" height=\"293\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/12\/place_picker-solution.png\" alt=\"\" class=\"wp-image-25929\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/12\/place_picker-solution.png 721w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/12\/place_picker-solution-300x122.png 300w\" sizes=\"auto, (max-width: 721px) 100vw, 721px\" \/><\/figure><\/div>\n\n\n\n<p>Source (Stackoverflow):- <a href=\"https:\/\/stackoverflow.com\/questions\/69312392\/how-to-resolve-error-the-getter-body1-isnt-defined-for-the-class-texttheme\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/stackoverflow.com\/questions\/69312392\/how-to-resolve-error-the-getter-body1-isnt-defined-for-the-class-texttheme<\/a><\/p>\n\n\n\n<p><strong>To fix this issue you have to make some changes to Two files<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>C:\/src\/flutter\/.pub-cache\/hosted\/pub.dartlang.org\/place_picker-0.9.19-nullsafety\/lib\/widgets\/rich_suggestion.dart<\/li><\/ol>\n\n\n\n<p>2. C:\/src\/flutter\/.pub-cache\/hosted\/pub.dartlang.org\/place_picker-0.9.19-nullsafety\/lib\/widgets\/search_input.dart<\/p>\n\n\n\n<p class=\"has-text-align-center\"><span class=\"has-inline-color has-vivid-red-color\"><strong>Changes to Done<\/strong><\/span><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/12\/rich_suggestion.dart-and-search_input.dart_.png\" alt=\"\" class=\"wp-image-25930\" width=\"840\" height=\"530\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/12\/rich_suggestion.dart-and-search_input.dart_.png 845w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/12\/rich_suggestion.dart-and-search_input.dart_-300x190.png 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2021\/12\/rich_suggestion.dart-and-search_input.dart_-768x485.png 768w\" sizes=\"auto, (max-width: 840px) 100vw, 840px\" \/><\/figure><\/div>\n\n\n\n<p>Edit the lines in the dart package like below and it will work. Of course, the author should do this, but you can edit it yourself as well \ud83d\ude42<\/p>\n\n\n\n<p><strong><span class=\"has-inline-color has-vivid-red-color\">rich_suggestion.dart<\/span><\/strong><br><strong>Original<\/strong>: TextSpan(text: boldText, style: style.copyWith(color: Theme.of(context).textTheme.body1!.color)),<\/p>\n\n\n\n<p><strong>New<\/strong>: TextSpan(text: boldText, style: style.copyWith(color: Theme.of(context).textTheme.bodyText1!.color)),<\/p>\n\n\n\n<p><strong><span class=\"has-inline-color has-vivid-red-color\">search_input.dart<\/span><\/strong><br><strong>Original<\/strong>: Icon(Icons.search, color: Theme.of(context).textTheme.body1!.color),<\/p>\n\n\n\n<p><strong>New<\/strong>: Icon(Icons.search, color: Theme.of(context).textTheme.bodyText1!.color),<\/p>\n\n\n\n<p>Ticket Source (Github):- <a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/github.com\/blackmann\/locationpicker\/issues\/63\">https:\/\/github.com\/blackmann\/locationpicker\/issues\/63<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Error SOLUTION Here is what I found on StackOverflow Source (Stackoverflow):- https:\/\/stackoverflow.com\/questions\/69312392\/how-to-resolve-error-the-getter-body1-isnt-defined-for-the-class-texttheme To fix this issue you have to make some changes to Two files C:\/src\/flutter\/.pub-cache\/hosted\/pub.dartlang.org\/place_picker-0.9.19-nullsafety\/lib\/widgets\/rich_suggestion.dart 2. C:\/src\/flutter\/.pub-cache\/hosted\/pub.dartlang.org\/place_picker-0.9.19-nullsafety\/lib\/widgets\/search_input.dart Changes to&#8230; <\/p>\n","protected":false},"author":19,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[6331],"tags":[7112,7113,7116,6203,7115],"class_list":["post-25926","post","type-post","status-publish","format-standard","hentry","category-flutter","tag-appcompileflutterbuilddebug","tag-exception-gradle-task-assembledebug-failed","tag-failure-build-failed-with-an-exception","tag-flutter","tag-place_picker"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/25926","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=25926"}],"version-history":[{"count":7,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/25926\/revisions"}],"predecessor-version":[{"id":25951,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/25926\/revisions\/25951"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=25926"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=25926"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=25926"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}