<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jermaine</title>
    <description>The latest articles on DEV Community by Jermaine (@creativ_bracket).</description>
    <link>https://dev.to/creativ_bracket</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F68659%2Fe946936d-fa8a-419b-8d26-6bffa70fbbcf.jpg</url>
      <title>DEV Community: Jermaine</title>
      <link>https://dev.to/creativ_bracket</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/creativ_bracket"/>
    <language>en</language>
    <item>
      <title>Supabase &amp; Riverpod Minicourse | Build A Realtime Photo Sharing App</title>
      <dc:creator>Jermaine</dc:creator>
      <pubDate>Tue, 25 Apr 2023 07:13:54 +0000</pubDate>
      <link>https://dev.to/creativ_bracket/supabase-riverpod-minicourse-build-a-realtime-photo-sharing-app-o1o</link>
      <guid>https://dev.to/creativ_bracket/supabase-riverpod-minicourse-build-a-realtime-photo-sharing-app-o1o</guid>
      <description>&lt;p&gt;In this free minicourse, we will build a realtime photo sharing app with &lt;a href="https://supabase.com"&gt;Supabase&lt;/a&gt;, &lt;a href="https://flutter.dev"&gt;Flutter&lt;/a&gt; and &lt;a href="https://docs-v2.riverpod.dev"&gt;Riverpod&lt;/a&gt;. Supabase is an open-source Firebase alternative that offers a set of tools to create scalable and secure web and mobile applications.&lt;/p&gt;

&lt;p&gt;Flutter is an open-source framework by Google for building natively compiled, multi-platform applications. The SDK is written in Dart which prides itself as being a flexible, general-purpose programming language which supports both AOT and JIT compilation targets.&lt;/p&gt;

&lt;p&gt;On the other hand, Riverpod is a state management library for Flutter that provides a simple, composable way of managing application state. It uses dependency injection to enable sharing state across the app and offers an intuitive API for managing state.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://youtu.be/510QYduXBXc"&gt;Watch the minicourse&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Get Started
&lt;/h2&gt;

&lt;p&gt;To get set up and prepped for the course:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://github.com/graphicbeacon/supabase_riverpod_minicourse"&gt;Get the source code&lt;/a&gt; on GitHub. It contains the starting base that we build upon in the course&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://database.new"&gt;Create a Supabase account&lt;/a&gt; or spin up a Docker instance. This is a necessary first step to create our Supabase project&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.flutter.dev/get-started/install"&gt;Install the Flutter SDK&lt;/a&gt;. &lt;em&gt;This is what we're building our app with&lt;/em&gt; 🔥&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Package Dependencies
&lt;/h2&gt;

&lt;p&gt;There are several dependencies that are added to the project, though the important ones are:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://pub.dev/packages/supabase_flutter"&gt;supabase_flutter&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;This contains the client library for interacting with Supabase. Creating a Supabase account and project will expose a &lt;strong&gt;Project url&lt;/strong&gt; as well as an &lt;strong&gt;API key&lt;/strong&gt;. These will enable you to initialise Supabase by doing the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:supabase_flutter/supabase_flutter.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="kd"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;WidgetsFlutterBinding&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;ensureInitialized&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;Supabase&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;initialize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nl"&gt;url:&lt;/span&gt; &lt;span class="s"&gt;'SUPABASE_URL'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;anonKey:&lt;/span&gt; &lt;span class="s"&gt;'SUPABASE_ANON_KEY'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="n"&gt;runApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;MyApp&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Initialising Supabase successfully gives you access to the &lt;code&gt;SupabaseClient&lt;/code&gt; object by doing the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;final supabase = Supabase.instance.client;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;a href="https://pub.dev/packages/flutter_riverpod"&gt;flutter_riverpod&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;This allows using the riverpod state management solution in a Flutter project. We will be creating several Providers and Notifier instances via Code Generation, available via Riverpod 2+.&lt;/p&gt;

&lt;p&gt;Here is a snippet of how creating a Provider that exposes a Repository client looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="c1"&gt;// file: memory_repository.dart&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:riverpod_annotation/riverpod_annotation.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:supabase_flutter/supabase_flutter.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;part&lt;/span&gt; &lt;span class="s"&gt;'memory_repository.g.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="nd"&gt;@riverpod&lt;/span&gt;
&lt;span class="n"&gt;MemoryRepository&lt;/span&gt; &lt;span class="nf"&gt;memoryRepository&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;MemoryRepositoryRef&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;MemoryRepository&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MemoryRepository&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;_client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Supabase&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;client&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="n"&gt;Future&lt;/span&gt; &lt;span class="n"&gt;getMemories&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="kd"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;_client&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'memories'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;select&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'id, title, image_id'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;order&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'created_at'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'll then be able to generate the relevant &lt;code&gt;AutoDisposeProvider&amp;lt;MemoryRepository&amp;gt;&lt;/code&gt; object by running the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;flutter pub run build_runner build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When listening to authentication state changes, the &lt;code&gt;StreamProvider&amp;lt;T&amp;gt;&lt;/code&gt; object is quite effective for sharing the Supabase authentication state:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="c1"&gt;// file: auth_user.dart&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:riverpod_annotation/riverpod_annotation.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:supabase_flutter/supabase_flutter.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;part&lt;/span&gt; &lt;span class="s"&gt;'auth_user.g.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="nd"&gt;@riverpod&lt;/span&gt;
&lt;span class="n"&gt;Stream&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;authUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;AuthUserRef&lt;/span&gt; &lt;span class="n"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kd"&gt;async&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;authStream&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Supabase&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;client&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;auth&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;onAuthStateChange&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;authState&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;authStream&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="n"&gt;authState&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;session&lt;/span&gt;&lt;span class="o"&gt;?.&lt;/span&gt;&lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Watch full minicourse below 🚀
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/510QYduXBXc"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Sharing is caring
&lt;/h2&gt;

&lt;p&gt;If you enjoyed reading this post, please share this through your social media channels. Also check out and &lt;a href="https://youtube.com/CreativeBracket"&gt;subscribe to my YouTube channel&lt;/a&gt; (hit the bell icon too) for full-stack development tutorials on Dart and Flutter.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://eepurl.com/gipQBX"&gt;Subscribe to the newsletter&lt;/a&gt; for my free &lt;strong&gt;Get started with Dart&lt;/strong&gt; eBook and to be notified when new content is released.&lt;/p&gt;

&lt;p&gt;Like, share and &lt;a href="https://twitter.com/creativ_bracket"&gt;follow me&lt;/a&gt; for more content on Dart.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="//https://&amp;lt;br&amp;gt;%0Acreativebracket.com/supabase-riverpod-minicourse-build-a-realtime-photo-sharing-app/"&gt;https://creativebracket.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>backend</category>
      <category>supabase</category>
    </item>
    <item>
      <title>Firebase Authentication and Flutter Full Course 2020 | Watch on YouTube</title>
      <dc:creator>Jermaine</dc:creator>
      <pubDate>Fri, 20 Nov 2020 14:02:21 +0000</pubDate>
      <link>https://dev.to/creativ_bracket/firebase-authentication-and-flutter-full-course-2020-3m90</link>
      <guid>https://dev.to/creativ_bracket/firebase-authentication-and-flutter-full-course-2020-3m90</guid>
      <description>&lt;p&gt;Firebase is a platform that provides the infrastructure needed to build apps fast. In the &lt;a href="https://creativebracket.com/fullstack-flutter-mongodb-mini-course/"&gt;previous&lt;/a&gt; mini-course we built a mobile and web app with Flutter and MongoDB. In this full course we will build a messaging app with Firebase Authentication and Flutter.&lt;/p&gt;

&lt;p&gt;We begin by setting up a Flutter project from scratch and building the general look and feel of our messaging UI. We then create a Firebase project while setting up and configuring our Android and Web applications. We will set up Firebase Authentication with the &lt;a href="https://pub.dev/packages/google_sign_in"&gt;&lt;strong&gt;google_sign_in&lt;/strong&gt;&lt;/a&gt; package and Cloud Firestore for storing our chat messages. We will learn how to set up the correct security rules to ensure only authenticated users are allowed to write data to our collection.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/oyVDDRczuJI"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/9zBWglEaGuQ"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Set up Flutter project
&lt;/h2&gt;

&lt;p&gt;Before creating a Flutter project we need to enable Flutter Web support since we will also be running this app in the Web browser. Run the following commands to enable Flutter Web support:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;flutter channel beta &lt;span class="c"&gt;# checkout the beta channel&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;flutter upgrade
&lt;span class="nv"&gt;$ &lt;/span&gt;flutter config &lt;span class="nt"&gt;--enable-web&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cT9xR6kk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/jz4txtz2v3nmgpixy8jo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cT9xR6kk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/jz4txtz2v3nmgpixy8jo.png" alt="Alt Text" width="800" height="221"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With Flutter Web enabled you can proceed to create your Flutter project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;flutter create my_messaging_app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that process is complete open the directory in your editor of choice, whether Visual Studio Code or Android Studio as the recommended editors for Flutter development.&lt;/p&gt;

&lt;p&gt;Ensure you have the relevant extensions installed for your editors. In the case of Visual Studio Code you need the &lt;a href="https://dartcode.org/"&gt;Dart Code extensions&lt;/a&gt;. For Android Studio search for “Flutter” in the plugins repository under &lt;strong&gt;Configure&lt;/strong&gt; &amp;gt; &lt;strong&gt;Plugins&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run the Flutter project
&lt;/h2&gt;

&lt;p&gt;Launch any of the device simulators using the steps in Visual Studio Code below. This assumes you have the listed simulators already set up using AVD Manager in Android Studio or any other means. Make sure that the simulator you select has Play Store support enabled.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--U9eSGI_S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/jdr5sen18hal42z34m96.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--U9eSGI_S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/jdr5sen18hal42z34m96.png" alt="Alt Text" width="800" height="516"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can run a Flutter project by typing the &lt;code&gt;flutter run&lt;/code&gt; command in the Terminal and hitting &lt;code&gt;Enter&lt;/code&gt;. Alternatively you can use the editor controls to run your Flutter app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build UI for Firebase Authentication
&lt;/h2&gt;

&lt;p&gt;Open &lt;strong&gt;lib/main.dart&lt;/strong&gt; and refactor the &lt;code&gt;MyApp&lt;/code&gt; StatelessWidget like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyApp&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;StatelessWidget&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="n"&gt;Widget&lt;/span&gt; &lt;span class="n"&gt;build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BuildContext&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;MaterialApp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="nl"&gt;title:&lt;/span&gt; &lt;span class="s"&gt;'The Chat Crew'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// &amp;lt;== Change this line&lt;/span&gt;
      &lt;span class="nl"&gt;debugShowCheckedModeBanner:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// &amp;lt;== Add this line&lt;/span&gt;
      &lt;span class="nl"&gt;theme:&lt;/span&gt; &lt;span class="n"&gt;ThemeData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nl"&gt;primarySwatch:&lt;/span&gt; &lt;span class="n"&gt;Colors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;purple&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// &amp;lt;== Change this line&lt;/span&gt;
      &lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="nl"&gt;home:&lt;/span&gt; &lt;span class="n"&gt;MyHomePage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;title:&lt;/span&gt; &lt;span class="s"&gt;'The Chat Crew'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="c1"&gt;// &amp;lt;== Change this line&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xjZrj453--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/zoiy94ovt7nrp0ifg90z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xjZrj453--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/zoiy94ovt7nrp0ifg90z.png" alt="Alt Text" width="422" height="877"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Refactor the &lt;code&gt;_MyHomePageState&lt;/code&gt; class by removing the &lt;code&gt;_incrementCounter()&lt;/code&gt; method and &lt;code&gt;_counter&lt;/code&gt; field.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;_MyHomePageState&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;State&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;MyHomePage&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Remove commented out lines&lt;/span&gt;
  &lt;span class="c1"&gt;// int _counter = 0; &lt;/span&gt;
  &lt;span class="c1"&gt;// void _incrementCounter() { &lt;/span&gt;
  &lt;span class="c1"&gt;// setState(() { &lt;/span&gt;
  &lt;span class="c1"&gt;//   _counter++; &lt;/span&gt;
  &lt;span class="c1"&gt;// }); &lt;/span&gt;
  &lt;span class="c1"&gt;// } &lt;/span&gt;
  &lt;span class="nd"&gt;@override&lt;/span&gt; &lt;span class="n"&gt;Widget&lt;/span&gt; &lt;span class="n"&gt;build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BuildContext&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the &lt;code&gt;build()&lt;/code&gt; method remove the &lt;code&gt;floatingActionButton:&lt;/code&gt; section of the &lt;code&gt;Scaffold()&lt;/code&gt; widget and the two &lt;code&gt;Text()&lt;/code&gt; widgets rendered in the &lt;code&gt;Column()&lt;/code&gt; children. In fact you should have the code below once you've taken out the unnecessary bits:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;_MyHomePageState&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;State&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;MyHomePage&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nd"&gt;@override&lt;/span&gt; &lt;span class="n"&gt;Widget&lt;/span&gt; &lt;span class="n"&gt;build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BuildContext&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;Scaffold&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="nl"&gt;appBar:&lt;/span&gt; &lt;span class="n"&gt;AppBar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nl"&gt;title:&lt;/span&gt; &lt;span class="n"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;widget&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="nl"&gt;centerTitle:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// &amp;lt;== Added this line&lt;/span&gt;
      &lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="nl"&gt;backgroundColor:&lt;/span&gt; &lt;span class="n"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;0xffdee2d6&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="c1"&gt;// &amp;lt;== Added this line &lt;/span&gt;
      &lt;span class="nl"&gt;body:&lt;/span&gt; &lt;span class="n"&gt;Column&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nl"&gt;mainAxisAlignment:&lt;/span&gt; &lt;span class="n"&gt;MainAxisAlignment&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;center&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;children:&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Widget&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;[],&lt;/span&gt;
      &lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---F4wdAJ---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/h6v7slq0icip5a0n2c6v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---F4wdAJ---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/h6v7slq0icip5a0n2c6v.png" alt="Alt Text" width="422" height="883"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The section below the app bar of the app consists of a message wall to display chat messages and the bottom area which will show either the sign in button or the message form.&lt;/p&gt;

&lt;p&gt;The message wall will be rendered in an &lt;code&gt;Expanded()&lt;/code&gt; widget since that takes up most of the screen real estate.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="nl"&gt;body:&lt;/span&gt; &lt;span class="n"&gt;Column&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; 
  &lt;span class="nl"&gt;mainAxisAlignment:&lt;/span&gt; &lt;span class="n"&gt;MainAxisAlignment&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;center&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;children:&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Widget&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;[&lt;/span&gt;
    &lt;span class="n"&gt;Expanded&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;Container&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;),&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To display the Sign in button, install the &lt;a href="https://pub.dev/packages/flutter_signin_button"&gt;&lt;strong&gt;flutter_signin_button&lt;/strong&gt;&lt;/a&gt; package:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:flutter_signin_button/flutter_signin_button.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
 &lt;span class="p"&gt;..&lt;/span&gt; 
&lt;span class="nl"&gt;body:&lt;/span&gt; &lt;span class="n"&gt;Column&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nl"&gt;mainAxisAlignment:&lt;/span&gt; &lt;span class="n"&gt;MainAxisAlignment&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;center&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;children:&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Widget&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;[&lt;/span&gt;
    &lt;span class="n"&gt;Expanded&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;Container&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="c1"&gt;// Add the widget below&lt;/span&gt;
    &lt;span class="n"&gt;Container&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="nl"&gt;padding:&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;EdgeInsets&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;SignInButton&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;Buttons&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;Google&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;padding:&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;EdgeInsets&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="nl"&gt;onPressed:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{},&lt;/span&gt;
      &lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;),&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Stop the whole app and start again&lt;/strong&gt; in order to load the image assets required to display the Google logo on the sign in button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HIPizJgA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/nbdw4a60pjvnn1gi2t51.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HIPizJgA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/nbdw4a60pjvnn1gi2t51.png" alt="Alt Text" width="422" height="879"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://youtu.be/oyVDDRczuJI"&gt;&lt;strong&gt;Watch the full course&lt;/strong&gt;&lt;/a&gt; for details on completing the sign in and sign out flows.&lt;/p&gt;




&lt;h2&gt;
  
  
  Sharing is caring 🤗
&lt;/h2&gt;

&lt;p&gt;If you enjoyed reading this post, please share this through your social media channels. Also check out and &lt;a href="https://youtube.com/c/CreativeBracket"&gt;&lt;strong&gt;subscribe&lt;/strong&gt;&lt;/a&gt; to my YouTube channel (hit the bell icon too) for full-stack development tutorials on Dart and Flutter.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://eepurl.com/gipQBX"&gt;&lt;strong&gt;Subscribe to the newsletter&lt;/strong&gt;&lt;/a&gt; for my free 35-page Get started with Dart eBook and to be notified when new content is released.&lt;/p&gt;

&lt;p&gt;Like, share and &lt;a href="https://twitter.com/creativ_bracket"&gt;&lt;strong&gt;follow me&lt;/strong&gt;&lt;/a&gt; for more content on Dart.&lt;/p&gt;

&lt;p&gt;Originally published at &lt;a href="https://creativebracket.com/firebase-authentication-and-flutter-full-course-2020/"&gt;https://creativebracket.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>dart</category>
      <category>flutter</category>
      <category>googlecloud</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Fullstack Flutter and MongoDB Cloud Mini-Course | FREE TO WATCH!!!</title>
      <dc:creator>Jermaine</dc:creator>
      <pubDate>Tue, 06 Oct 2020 10:33:46 +0000</pubDate>
      <link>https://dev.to/creativ_bracket/fullstack-flutter-and-mongodb-cloud-mini-course-free-to-watch-31f5</link>
      <guid>https://dev.to/creativ_bracket/fullstack-flutter-and-mongodb-cloud-mini-course-free-to-watch-31f5</guid>
      <description>&lt;p&gt;After numerous requests to produce a Flutter and MongoDB combo, I've devoted the time to produce a fullstack Flutter and MongoDb Cloud mini-course. We will build a contacts list application that manages contacts in MongoDB Cloud Atlas database. We will also implement a Dart backend server for talking to MongoDB datastore. This app will be built for both Flutter mobile and web platforms.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/juKDXPk7kU4"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;p&gt;You will need a &lt;a href="https://www.mongodb.com/cloud" rel="noopener noreferrer"&gt;MongoDB Cloud Account&lt;/a&gt; to create a Project and Cluster. This will give us an environment with MongoDB installed and a user to connect to that MongoDB instance.&lt;/p&gt;

&lt;p&gt;The contents of the mini-course are as follows:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://youtube.com/watch?v=juKDXPk7kU4&amp;amp;t=0s" rel="noopener noreferrer"&gt;&lt;strong&gt;00:00&lt;/strong&gt;&lt;/a&gt; Intro&lt;br&gt;
&lt;a href="https://youtube.com/watch?v=juKDXPk7kU4&amp;amp;t=7s" rel="noopener noreferrer"&gt;&lt;strong&gt;00:07&lt;/strong&gt;&lt;/a&gt; App Demo&lt;br&gt;
&lt;a href="https://youtube.com/watch?v=juKDXPk7kU4&amp;amp;t=128s" rel="noopener noreferrer"&gt;&lt;strong&gt;02:08&lt;/strong&gt;&lt;/a&gt; Setup MongoDB Cloud Atlas Project and Cluster&lt;br&gt;
&lt;a href="https://youtube.com/watch?v=juKDXPk7kU4&amp;amp;t=198s" rel="noopener noreferrer"&gt;&lt;strong&gt;03:18&lt;/strong&gt;&lt;/a&gt; Connect to MongoDB Cluster via Terminal&lt;br&gt;
&lt;a href="https://youtube.com/watch?v=juKDXPk7kU4&amp;amp;t=272s" rel="noopener noreferrer"&gt;&lt;strong&gt;04:32&lt;/strong&gt;&lt;/a&gt; Examine codebase and dependencies&lt;br&gt;
&lt;a href="https://youtube.com/watch?v=juKDXPk7kU4&amp;amp;t=313s" rel="noopener noreferrer"&gt;&lt;strong&gt;05:13&lt;/strong&gt;&lt;/a&gt; Connect to MongoDB from codebase&lt;br&gt;
&lt;a href="https://youtube.com/watch?v=juKDXPk7kU4&amp;amp;t=374s" rel="noopener noreferrer"&gt;&lt;strong&gt;06:14&lt;/strong&gt;&lt;/a&gt; Create server and initial route&lt;br&gt;
&lt;a href="https://youtube.com/watch?v=juKDXPk7kU4&amp;amp;t=450s" rel="noopener noreferrer"&gt;&lt;strong&gt;07:30&lt;/strong&gt;&lt;/a&gt; Add POST and DELETE endpoints&lt;br&gt;
&lt;a href="https://youtube.com/watch?v=juKDXPk7kU4&amp;amp;t=599s" rel="noopener noreferrer"&gt;&lt;strong&gt;09:59&lt;/strong&gt;&lt;/a&gt; Implement initial contacts screen&lt;br&gt;
&lt;a href="https://youtube.com/watch?v=juKDXPk7kU4&amp;amp;t=704s" rel="noopener noreferrer"&gt;&lt;strong&gt;11:44&lt;/strong&gt;&lt;/a&gt; Implements "No contacts" view&lt;br&gt;
&lt;a href="https://youtube.com/watch?v=juKDXPk7kU4&amp;amp;t=821s" rel="noopener noreferrer"&gt;&lt;strong&gt;13:41&lt;/strong&gt;&lt;/a&gt; Implement contact addition functionality&lt;br&gt;
&lt;a href="https://youtube.com/watch?v=juKDXPk7kU4&amp;amp;t=899s" rel="noopener noreferrer"&gt;&lt;strong&gt;14:59&lt;/strong&gt;&lt;/a&gt; Style ListTile widget&lt;br&gt;
&lt;a href="https://youtube.com/watch?v=juKDXPk7kU4&amp;amp;t=982s" rel="noopener noreferrer"&gt;&lt;strong&gt;16:22&lt;/strong&gt;&lt;/a&gt; Refactor NoContacts widget&lt;br&gt;
&lt;a href="https://youtube.com/watch?v=juKDXPk7kU4&amp;amp;t=1021s" rel="noopener noreferrer"&gt;&lt;strong&gt;17:01&lt;/strong&gt;&lt;/a&gt; Create ContactListing widget&lt;br&gt;
&lt;a href="https://youtube.com/watch?v=juKDXPk7kU4&amp;amp;t=1100s" rel="noopener noreferrer"&gt;&lt;strong&gt;18:20&lt;/strong&gt;&lt;/a&gt; Using the Faker package&lt;br&gt;
&lt;a href="https://youtube.com/watch?v=juKDXPk7kU4&amp;amp;t=1133s" rel="noopener noreferrer"&gt;&lt;strong&gt;18:53&lt;/strong&gt;&lt;/a&gt; Adding contact deletion functionality&lt;br&gt;
&lt;a href="https://youtube.com/watch?v=juKDXPk7kU4&amp;amp;t=1207s" rel="noopener noreferrer"&gt;&lt;strong&gt;20:07&lt;/strong&gt;&lt;/a&gt; Implements ContactsApi class&lt;br&gt;
&lt;a href="https://youtube.com/watch?v=juKDXPk7kU4&amp;amp;t=1406s" rel="noopener noreferrer"&gt;&lt;strong&gt;23:26&lt;/strong&gt;&lt;/a&gt; Create Contact PODO&lt;br&gt;
&lt;a href="https://youtube.com/watch?v=juKDXPk7kU4&amp;amp;t=1701s" rel="noopener noreferrer"&gt;&lt;strong&gt;28:21&lt;/strong&gt;&lt;/a&gt; Implement contact creation method on api class&lt;br&gt;
&lt;a href="https://youtube.com/watch?v=juKDXPk7kU4&amp;amp;t=1791s" rel="noopener noreferrer"&gt;&lt;strong&gt;29:51&lt;/strong&gt;&lt;/a&gt; Running app on Flutter Web&lt;br&gt;
&lt;a href="https://youtube.com/watch?v=juKDXPk7kU4&amp;amp;t=2224s" rel="noopener noreferrer"&gt;&lt;strong&gt;37:04&lt;/strong&gt;&lt;/a&gt; Outro&lt;/p&gt;

&lt;p&gt;Clone and check out the &lt;code&gt;starter&lt;/code&gt; branch on the &lt;a href="https://github.com/graphicbeacon/flutter_mongodb_contacts_app" rel="noopener noreferrer"&gt;Github repo&lt;/a&gt;. This will provide the correct setup to follow along in the Fullstack Flutter and MongoDB Cloud mini-course.&lt;/p&gt;

&lt;p&gt;The Dart packages included in this mini-course are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://pub.dev/packages/sevr" rel="noopener noreferrer"&gt;&lt;strong&gt;sevr&lt;/strong&gt;&lt;/a&gt; - a Dart library inspired by ExpressJS for writing HTTP servers. We use this to write a server that communicates with our MongoDB Cloud Cluster.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://pub.dev/packages/dio" rel="noopener noreferrer"&gt;&lt;strong&gt;dio&lt;/strong&gt;&lt;/a&gt; - a powerful HTTP client for Dart. We use this to make requests to our Dart backend server.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://pub.dev/packages/faker" rel="noopener noreferrer"&gt;&lt;strong&gt;faker&lt;/strong&gt;&lt;/a&gt; - a library that generates various fake data. We use this to generate the contact names of our Fullstack Flutter app.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://pub.dev/packages/mongo_dart" rel="noopener noreferrer"&gt;&lt;strong&gt;mongo_dart&lt;/strong&gt;&lt;/a&gt; - a library for communicating with MongoDB databases. This allows us to talk to MongoDb Cloud Atlas.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Implementing the server
&lt;/h2&gt;

&lt;p&gt;In &lt;strong&gt;server/lib/server.dart&lt;/strong&gt; initiate a connection to MongoDB Cloud Atlas:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:mongo_dart/mongo_dart.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:sevr/sevr.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;start&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="kd"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Log into database&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;Db&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="s"&gt;'mongodb+srv://&amp;lt;user&amp;gt;:&amp;lt;password&amp;gt;@cluster0.xpkap.mongodb.net/&amp;lt;dbname&amp;gt;?retryWrites=true&amp;amp;w=majority'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;open&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Initiate the connection&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;coll&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'contacts'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Define a handle to the contacts collection&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The database connection string can be found by clicking the "&lt;strong&gt;CONNECT&lt;/strong&gt;" button on your cluster and then selecting "&lt;strong&gt;Connect your application&lt;/strong&gt;" as the connection method.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdrwdwiqguc0tb6hzuy1i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdrwdwiqguc0tb6hzuy1i.png" alt="Getting the database connection string"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Opening a connection to our MongoDB Cloud Cluster means we can create a server that acts as a gateway to our database:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;start&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="kd"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Log into database&lt;/span&gt;
  &lt;span class="p"&gt;..&lt;/span&gt;
  &lt;span class="c1"&gt;// Create server&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;port&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;8081&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;serv&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Sevr&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our HTTP server is contained within the sevr variable which allows us to go ahead and define our first route:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;start&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="kd"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Log into database&lt;/span&gt;
  &lt;span class="p"&gt;..&lt;/span&gt;
  &lt;span class="c1"&gt;// Create server&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;port&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;8081&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;serv&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Sevr&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="c1"&gt;// Define routes&lt;/span&gt;
  &lt;span class="n"&gt;serv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'/'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ServRequest&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ServResponse&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kd"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;contacts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;coll&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;find&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;toList&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="s"&gt;'contacts'&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;contacts&lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;]);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our first route describes a path and the data to be returned for any client that makes a request to it, in this case being a &lt;code&gt;GET&lt;/code&gt; request to the root route of our server. We are returning the list of contacts in our MongoDb collection.&lt;/p&gt;

&lt;p&gt;To activate our server and routes we need to listen to incoming connections:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;start&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="kd"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Log into database&lt;/span&gt;
  &lt;span class="p"&gt;..&lt;/span&gt;
  &lt;span class="c1"&gt;// Create server&lt;/span&gt;
  &lt;span class="p"&gt;..&lt;/span&gt;
  &lt;span class="c1"&gt;// Define routes&lt;/span&gt;
  &lt;span class="p"&gt;..&lt;/span&gt;
  &lt;span class="c1"&gt;// Listen for connections&lt;/span&gt;
  &lt;span class="n"&gt;serv&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;callback:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Server listening on port: &lt;/span&gt;&lt;span class="si"&gt;$port&lt;/span&gt;&lt;span class="s"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Running this in the terminal will give you the output below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbhl1ikogs5sdmmf2u041.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbhl1ikogs5sdmmf2u041.png" alt="Running server in terminal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Learn more from the full mini-course.&lt;/p&gt;

&lt;p&gt;→&lt;a href="https://youtu.be/juKDXPk7kU4" rel="noopener noreferrer"&gt;&lt;strong&gt;Watch the Fullstack Flutter MongoDB Cloud Mini-Course&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
→&lt;a href="https://github.com/graphicbeacon/flutter_mongodb_contacts_app" rel="noopener noreferrer"&gt;&lt;strong&gt;Get the source code&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Sharing is caring 🤗
&lt;/h2&gt;

&lt;p&gt;If you enjoyed reading this post, please share this through the social buttons on this page. &lt;a href="https://youtube.com/c/CreativeBracket" rel="noopener noreferrer"&gt;Subscribe&lt;/a&gt; to the YouTube channel for tutorials demonstrating how to build full-stack applications with Dart and Flutter.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://eepurl.com/gipQBX" rel="noopener noreferrer"&gt;Subscribe to the newsletter&lt;/a&gt; to access our free 35-page Get started with Dart eBook and to be notified when new content is released.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Like, share and &lt;a href="https://twitter.com/creativ_bracket" rel="noopener noreferrer"&gt;follow me&lt;/a&gt;&lt;/strong&gt; for more content on Dart and Flutter.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://creativebracket.com/fullstack-flutter-mongodb-mini-course/" rel="noopener noreferrer"&gt;creativebracket.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>dart</category>
      <category>flutter</category>
      <category>mongodb</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Google Cloud Platform and Flutter Mini-Course released! | FREE TO WATCH</title>
      <dc:creator>Jermaine</dc:creator>
      <pubDate>Fri, 25 Sep 2020 12:36:41 +0000</pubDate>
      <link>https://dev.to/creativ_bracket/google-cloud-platform-and-flutter-mini-course-released-5b10</link>
      <guid>https://dev.to/creativ_bracket/google-cloud-platform-and-flutter-mini-course-released-5b10</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/CV0vGWDtCR0"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Becoming a full-stack developer requires a hand in all layers of the application development stack. This includes Frontend, Backend, Database and Infrastructure.&lt;/p&gt;

&lt;p&gt;Google Cloud Platform is a suite of cloud computing services used by Google and external business for running various kinds of software. This platform contains relevant services allowing us to be effective in building full-stack applications.&lt;/p&gt;

&lt;p&gt;In the Google Cloud Platform and Flutter mini course we will build an Image Upload Mobile App using a couple of Dart packages primarily &lt;a href="https://pub.dev/packages/gcloud"&gt;gcloud&lt;/a&gt; and &lt;a href="https://pub.dev/packages/googleapis_auth"&gt;googleapis_auth&lt;/a&gt;. These packages provide a set of helper classes for connecting to Google Cloud Platform services.&lt;/p&gt;

&lt;p&gt;We will be using the &lt;a href="https://flutter.dev"&gt;Flutter SDK&lt;/a&gt; to build our mobile app since it provides a great set of features and tools for building cross-platform mobile applications. It also makes sense to be using Flutter as it's also written in Dart 😉&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;p&gt;We need to set up a &lt;a href="https://cloud.google.com"&gt;Google Cloud Platform&lt;/a&gt; account. It's free to set up and they're currently offering $300 credit for 90 days. This will allow you enough time to use the Cloud Storage service for uploading images to.&lt;/p&gt;

&lt;p&gt;The contents of the video are as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=CV0vGWDtCR0&amp;amp;t=0s"&gt;00:00&lt;/a&gt; Intro &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=CV0vGWDtCR0&amp;amp;t=19s"&gt;00:19&lt;/a&gt; App demo &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=CV0vGWDtCR0&amp;amp;t=57s"&gt;00:57&lt;/a&gt; Create a Google Cloud Project &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=CV0vGWDtCR0&amp;amp;t=92s"&gt;01:32&lt;/a&gt; Create a Cloud Storage bucket &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=CV0vGWDtCR0&amp;amp;t=131s"&gt;02:11&lt;/a&gt; Setup dependencies &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=CV0vGWDtCR0&amp;amp;t=163s"&gt;02:43&lt;/a&gt; Implement image picker&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=CV0vGWDtCR0&amp;amp;t=391s"&gt;06:31&lt;/a&gt; Create your IAM Service Account &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=CV0vGWDtCR0&amp;amp;t=471s"&gt;07:51&lt;/a&gt; Implement CloudApi Service class &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=CV0vGWDtCR0&amp;amp;t=574s"&gt;09:34&lt;/a&gt; Load IAM credentials into CloudApi Service &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=CV0vGWDtCR0&amp;amp;t=661s"&gt;11:01&lt;/a&gt; Make request to Google Cloud Storage &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=CV0vGWDtCR0&amp;amp;t=730s"&gt;12:10&lt;/a&gt; Set correct content type for image &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=CV0vGWDtCR0&amp;amp;t=871s"&gt;14:31&lt;/a&gt; Set custom metadata on image &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=CV0vGWDtCR0&amp;amp;t=908s"&gt;15:08&lt;/a&gt; Implement loading and uploaded state &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=CV0vGWDtCR0&amp;amp;t=1019s"&gt;16:59&lt;/a&gt; Set bucket access permissions &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=CV0vGWDtCR0&amp;amp;t=1066s"&gt;17:46&lt;/a&gt; Outro&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once you've set up a Google Cloud Platform account, create a Flutter project by running the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;flutter create new_project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the following packages under the &lt;code&gt;dependencies&lt;/code&gt; key of your &lt;strong&gt;pubspec.yaml&lt;/strong&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;dependencies&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
  &lt;span class="na"&gt;gcloud&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;^0.7.3&lt;/span&gt;
  &lt;span class="na"&gt;googleapis_auth&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;^0.2.12&lt;/span&gt;
  &lt;span class="na"&gt;image_picker&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;^0.6.7+10&lt;/span&gt;
  &lt;span class="na"&gt;mime&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;^0.9.7&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run &lt;code&gt;pub get&lt;/code&gt; to update your packages. Once you are setup, see the course for the full demonstration.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://youtu.be/CV0vGWDtCR0"&gt;&lt;strong&gt;Watch full mini-course&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Sharing is caring 🤗
&lt;/h2&gt;

&lt;p&gt;If you enjoyed reading this post, please share this through the social buttons on this page. &lt;a href="https://youtube.com/c/CreativeBracket"&gt;Subscribe&lt;/a&gt; to the YouTube channel for tutorials demonstrating how to build full-stack applications with Dart and Flutter.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://eepurl.com/gipQBX"&gt;Subscribe to the newsletter&lt;/a&gt; to access our free 35-page Get started with Dart eBook and to be notified when new content is released.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Like, share and &lt;a href="https://twitter.com/creativ_bracket"&gt;follow me&lt;/a&gt;&lt;/strong&gt; for more content on Dart and Flutter.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://creativebracket.com/google-cloud-platform-and-flutter-mini-course-released/"&gt;creativebracket.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>dart</category>
      <category>flutter</category>
      <category>webdev</category>
      <category>googlecloud</category>
    </item>
    <item>
      <title>Flutter for React developers video series</title>
      <dc:creator>Jermaine</dc:creator>
      <pubDate>Mon, 02 Mar 2020 00:07:09 +0000</pubDate>
      <link>https://dev.to/creativ_bracket/flutter-for-react-developers-video-series-1hf2</link>
      <guid>https://dev.to/creativ_bracket/flutter-for-react-developers-video-series-1hf2</guid>
      <description>&lt;p&gt;Picking the right tools for development is important when building a good app. The common mantra "&lt;strong&gt;&lt;em&gt;write once, deploy everywhere&lt;/em&gt;&lt;/strong&gt;" has proven to be effective from solutions like Phonegap or Ionic or NativeScript.&lt;/p&gt;

&lt;p&gt;Flutter is a contender by Google designed to enable developers to build cross-platform applications. These applications will run on the web, mobile and desktop. It's also written in Dart, which makes it easy to pick up in a couple of hours.&lt;/p&gt;

&lt;p&gt;Flutter is mainly inspired by React with some noteworthy improvements. For example apps written for mobile are compiled &lt;em&gt;ahead-of-time&lt;/em&gt; to machine code, so that means that the underlying language the app was written in does not enter production. This carries the benefit of not having to ship with the Dart VM, thus, drastically reducing app size and increasing performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 1
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/arIeSpgMZ7M"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 2
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Uxt7ycYNNHI"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Sharing is caring
&lt;/h2&gt;

&lt;p&gt;If you enjoyed reading this post, &lt;a href="https://youtube.com/c/CreativeBracket"&gt;subscribe to the YouTube channel&lt;/a&gt; (&lt;em&gt;hit the bell icon too&lt;/em&gt;) for more videos on Dart.&lt;/p&gt;

&lt;p&gt;Watch my &lt;a href="https://egghead.io/courses/get-started-with-dart"&gt;Free Get started with Dart course&lt;/a&gt; on Egghead.io and &lt;a href="http://eepurl.com/gipQBX"&gt;join my email newsletter&lt;/a&gt; to download my Free 35-page eBook titled Get started with Dart and to be notified when new content is released.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Like, share and &lt;a href="https://twitter.com/creativ_bracket"&gt;follow me&lt;/a&gt;&lt;/strong&gt; for more content on Dart.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://creativebracket.com/flutter-for-react-developers-video-series/"&gt;https://creativebracket.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>react</category>
      <category>reactnative</category>
    </item>
    <item>
      <title>What kind of apps would you like to see written in Dart?</title>
      <dc:creator>Jermaine</dc:creator>
      <pubDate>Mon, 03 Feb 2020 18:38:10 +0000</pubDate>
      <link>https://dev.to/creativ_bracket/what-kind-of-apps-would-you-like-to-see-written-in-dart-132c</link>
      <guid>https://dev.to/creativ_bracket/what-kind-of-apps-would-you-like-to-see-written-in-dart-132c</guid>
      <description>&lt;p&gt;I was going to add some introductory content about Dart being #1 fastest growing language according to Github's 2019 Annual Report, but I'd rather get to the point.&lt;/p&gt;

&lt;p&gt;So please...your thoughts on the question :)&lt;/p&gt;

</description>
      <category>dartlang</category>
      <category>discuss</category>
      <category>webdev</category>
      <category>flutter</category>
    </item>
    <item>
      <title>User Registration and Authentication with Dart video series</title>
      <dc:creator>Jermaine</dc:creator>
      <pubDate>Mon, 03 Feb 2020 09:03:40 +0000</pubDate>
      <link>https://dev.to/creativ_bracket/user-registration-and-authentication-with-dart-video-series-4jmp</link>
      <guid>https://dev.to/creativ_bracket/user-registration-and-authentication-with-dart-video-series-4jmp</guid>
      <description>&lt;p&gt;In this two-part series we will learn how to build a User Authentication system for use in your next application. User authentication allows access to specific resources on a system by verifying that a user has valid access to that resource.&lt;/p&gt;

&lt;p&gt;Watch Part 1 and 2 below. You can also &lt;a href="https://creativebracket.com/build-a-user-authentication-system-1/"&gt;follow the written tutorial&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Part 1
&lt;/h1&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/HloDTrNH37c"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h1&gt;
  
  
  Part 2
&lt;/h1&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/rHJxHSJY-8k"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Sharing is caring
&lt;/h2&gt;

&lt;p&gt;If you enjoyed reading this post, &lt;a href="https://youtube.com/c/CreativeBracket"&gt;subscribe to the YouTube channel&lt;/a&gt; (&lt;em&gt;hit the bell icon too&lt;/em&gt;) for more videos on Dart.&lt;/p&gt;

&lt;p&gt;Watch my &lt;a href="https://egghead.io/courses/get-started-with-dart"&gt;Free Get started with Dart course&lt;/a&gt; on Egghead.io and &lt;a href="http://eepurl.com/gipQBX"&gt;join my email newsletter&lt;/a&gt; to download my Free 35-page eBook titled Get started with Dart and to be notified when new content is released.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Like, share and &lt;a href="https://twitter.com/creativ_bracket"&gt;follow me&lt;/a&gt;&lt;/strong&gt; for more content on Dart.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://creativebracket.com/build-a-user-authentication-system-1/"&gt;https://creativebracket.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>dartlang</category>
      <category>webdev</category>
      <category>flutter</category>
    </item>
    <item>
      <title>Angel Dart Framework Tutorial series</title>
      <dc:creator>Jermaine</dc:creator>
      <pubDate>Sun, 26 Jan 2020 16:59:42 +0000</pubDate>
      <link>https://dev.to/creativ_bracket/angel-dart-framework-tutorial-series-1f5g</link>
      <guid>https://dev.to/creativ_bracket/angel-dart-framework-tutorial-series-1f5g</guid>
      <description>&lt;p&gt;In this video series we will look at the Angel Framework for backend Dart development, written by Tobe Osakwe, a Computer Science student. Angel comes batteries-included with dozens of plugins, enabling a "plug-and-play" approach to developing production quality applications. We will build a CMS for managing blog articles with validation and search functionality.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/iPbM10mvpko"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/graphicbeacon/angel_dart_cms_tutorial"&gt;&lt;strong&gt;Get the source code&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 2
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/jM9-JtIbokQ"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 3
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/dMIdLiwksUE"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 4
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/3T4iYYgpCJw"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 5
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/MxlOjq1UGrs"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Sharing is caring
&lt;/h2&gt;

&lt;p&gt;If you enjoyed reading this post, &lt;a href="https://youtube.com/c/CreativeBracket"&gt;subscribe to the YouTube channel&lt;/a&gt; (&lt;em&gt;hit the bell icon too&lt;/em&gt;) for more videos on Dart.&lt;/p&gt;

&lt;p&gt;Watch my &lt;a href="https://egghead.io/courses/get-started-with-dart"&gt;Free Get started with Dart course&lt;/a&gt; on Egghead.io and &lt;a href="http://eepurl.com/gipQBX"&gt;join my email newsletter&lt;/a&gt; to download my Free 35-page eBook titled Get started with Dart and to be notified when new content is released.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Like, share and &lt;a href="https://twitter.com/creativ_bracket"&gt;follow me&lt;/a&gt;&lt;/strong&gt; for more content on Dart.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://creativebracket.com/angel-dart-framework-tutorial-series/"&gt;https://creativebracket.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>dart</category>
      <category>mongodb</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Conquering Code Generation in Dart – Part 1: Write your first builder</title>
      <dc:creator>Jermaine</dc:creator>
      <pubDate>Sun, 06 Oct 2019 20:09:31 +0000</pubDate>
      <link>https://dev.to/creativ_bracket/conquering-code-generation-in-dart-part-1-write-your-first-builder-4g9g</link>
      <guid>https://dev.to/creativ_bracket/conquering-code-generation-in-dart-part-1-write-your-first-builder-4g9g</guid>
      <description>&lt;p&gt;Code Generation describes the process of automatically generating code that one would otherwise write by hand. In this new series we will be exploring the tooling made available for Code Generation for Dart projects.&lt;/p&gt;

&lt;p&gt;This has been one of the least covered and understood topics due to the lack of documentation on it. We will conquer this tooling beast and grow your confidence in its usage.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/H4HWB2Pmgcw"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  How to get started
&lt;/h2&gt;

&lt;p&gt;Code Generation is available through a package called &lt;a href="https://pub.dev/packages/build"&gt;build&lt;/a&gt;. This package exposes a set of interfaces for creating what are known as &lt;em&gt;Builders&lt;/em&gt;. A &lt;code&gt;builder&lt;/code&gt; is where you define the business logic to instruct the build process on how to generate code.&lt;/p&gt;

&lt;p&gt;Although we encapsulate our logic inside a &lt;code&gt;Builder&lt;/code&gt; class, we need a way to run this builder...and that's where &lt;a href="https://pub.dev/packages/build_runner"&gt;&lt;strong&gt;build_runner&lt;/strong&gt;&lt;/a&gt; comes in. It runs the build process based on configuration defined inside a &lt;code&gt;build.yaml&lt;/code&gt; file. In order for it to understand the &lt;code&gt;build.yaml&lt;/code&gt; configuration, the &lt;a href="https://pub.dev/packages/build_config"&gt;&lt;strong&gt;build_config&lt;/strong&gt;&lt;/a&gt; package is used to parse the the instructions defined therein. Therefore the &lt;strong&gt;build_runner&lt;/strong&gt; package uses &lt;strong&gt;build_config&lt;/strong&gt; behind the scenes.&lt;/p&gt;

&lt;p&gt;To create the files for the project use the &lt;a href="https://creativebracket.com/generate-the-scaffolding-for-your-next-project/"&gt;&lt;strong&gt;stagehand&lt;/strong&gt;&lt;/a&gt; tool to scaffold a console application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;code_generators &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;code_generators
&lt;span class="nv"&gt;$ &lt;/span&gt;stagehand console-full
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open the pubspec.yaml file and update &lt;code&gt;dependencies&lt;/code&gt; and &lt;code&gt;dev_dependencies&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;dependencies&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;^1.1.6&lt;/span&gt; &lt;span class="c1"&gt;# &amp;lt;-- Add this line&lt;/span&gt;
  &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;^1.6.0&lt;/span&gt;

&lt;span class="na"&gt;dev_dependencies&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
  &lt;span class="na"&gt;build_config&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;^0.4.1+1&lt;/span&gt; &lt;span class="c1"&gt;# &amp;lt;-- And this line&lt;/span&gt;
  &lt;span class="na"&gt;build_runner&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;^1.6.6&lt;/span&gt; &lt;span class="c1"&gt;# &amp;lt;-- And this line &lt;/span&gt;
  &lt;span class="na"&gt;pedantic&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;^1.7.0&lt;/span&gt; 
  &lt;span class="na"&gt;test&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;^1.5.0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update all your dependencies by running &lt;code&gt;pub get&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Configuring the &lt;code&gt;build.yaml&lt;/code&gt; file
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;build.yaml&lt;/code&gt; file contains configuration for &lt;strong&gt;targets&lt;/strong&gt;, &lt;strong&gt;builders&lt;/strong&gt;, and &lt;strong&gt;post process builders&lt;/strong&gt;. The &lt;code&gt;builders&lt;/code&gt; configuration allows you to register the builders you have implemented, as well as the top-level function to invoke in order to run the build process for the builder in question. You would also set the &lt;code&gt;build_extensions&lt;/code&gt; key with the same value as was set in the &lt;code&gt;buildExtensions&lt;/code&gt; member of your &lt;code&gt;Builder&lt;/code&gt; class the configuration relates to. The &lt;code&gt;targets&lt;/code&gt; config allows you to configure your builder to run on a subset of files in your project, as well as specify if they are enabled or not.&lt;/p&gt;

&lt;p&gt;Here’s a typical example registering our &lt;code&gt;CopyBuilder&lt;/code&gt; and configuring some targets for it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;targets&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
  &lt;span class="na"&gt;$default&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
    &lt;span class="na"&gt;builders&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
      &lt;span class="na"&gt;code_generators|copyBuilder&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
        &lt;span class="na"&gt;generate_for&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
         &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;lib/*&lt;/span&gt; 
        &lt;span class="na"&gt;enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;True&lt;/span&gt; 

&lt;span class="na"&gt;builders&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
  &lt;span class="na"&gt;copyBuilder&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
    &lt;span class="na"&gt;import&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;package:code_generators/code_generators.dart'&lt;/span&gt; 
    &lt;span class="na"&gt;builder_factories&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;copyBuilder'&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt; 
    &lt;span class="na"&gt;build_extensions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
      &lt;span class="na"&gt;.txt&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
       &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;.copy.txt&lt;/span&gt; 
    &lt;span class="na"&gt;build_to&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;source&lt;/span&gt; 
    &lt;span class="na"&gt;auto_apply&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;dependents&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://github.com/dart-lang/build/blob/master/build_config/README.md"&gt;Learn more about configuring the build.yaml file&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Continue the full tutorial in the video above.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/graphicbeacon/codegeneration_with_dart"&gt;&lt;strong&gt;Get the source code&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Sharing is caring
&lt;/h2&gt;

&lt;p&gt;If you enjoyed reading this post, please share this through the various social buttons hovering on the left/top side of the screen. Also, check out and &lt;a href="https://youtube.com/c/CreativeBracket"&gt;subscribe to my YouTube channel&lt;/a&gt; (&lt;em&gt;hit the bell icon too&lt;/em&gt;) for videos on Dart.&lt;/p&gt;

&lt;p&gt;Watch my &lt;a href="https://egghead.io/courses/get-started-with-dart"&gt;Free Get started with Dart course&lt;/a&gt; on Egghead.io and &lt;a href="http://eepurl.com/gipQBX"&gt;Subscribe to my email newsletter&lt;/a&gt; to download my Free 35-page eBook titled Get started with Dart and to be notified when new content is released.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Like, share and &lt;a href="https://twitter.com/creativ_bracket"&gt;follow me&lt;/a&gt;&lt;/strong&gt; for more content on Dart.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://creativebracket.com/conquering-code-generation-in-dart-1/"&gt;https://creativebracket.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>dart</category>
      <category>webdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Understanding Reflection and Annotations in Dart</title>
      <dc:creator>Jermaine</dc:creator>
      <pubDate>Mon, 01 Jul 2019 06:07:36 +0000</pubDate>
      <link>https://dev.to/creativ_bracket/understanding-reflection-and-annotations-in-dart-4kn1</link>
      <guid>https://dev.to/creativ_bracket/understanding-reflection-and-annotations-in-dart-4kn1</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally posted at &lt;a href="https://creativebracket.com/understanding-reflection-and-annotations-in-dart/"&gt;creativebracket.com&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In this video, we will explore the topic of Reflection and how that can be used to write cleaner software. Reflection allow us to examine and modify the structure and behaviour of a program at runtime. We will be working with the &lt;strong&gt;dart:mirrors&lt;/strong&gt; library which contains helper classes and functions for achieving this. We will end by looking at a common use case with &lt;strong&gt;Annotations&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/_2yjPLVEGs4"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Basic example with Reflection
&lt;/h2&gt;

&lt;p&gt;Create a &lt;code&gt;main.dart&lt;/code&gt; file and start by importing the &lt;strong&gt;dart:mirrors&lt;/strong&gt; library. Before we implement our reflection logic let's also define a class with a method we wish to invoke:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'dart:mirrors'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// TODO: Implement Reflection logic&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Our example class to reflect on&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Endpoint&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;handle&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Request received'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To reflect on types and objects we have three methods to work with:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;reflect()&lt;/strong&gt;: Reflects on an instance of a class&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;reflectClass()&lt;/strong&gt;: Reflects on a class declaration&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;reflectType()&lt;/strong&gt;: Reflects on the type passed in as the argument&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In our case we will use &lt;code&gt;reflect()&lt;/code&gt;. Let's instantiate &lt;code&gt;Endpoint&lt;/code&gt; and invoke the handle method via reflection:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;reflectedClass&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;reflect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Endpoint&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;

  &lt;span class="c1"&gt;// invoke the handle() method&lt;/span&gt;
  &lt;span class="n"&gt;reflectedclass&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;invoke&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Symbol&lt;/span&gt;&lt;span class="s"&gt;'handle'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;[]);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And then let's run this file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;dart /path/to/main.dart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reflecting an instance provides us with an &lt;code&gt;InstanceMirror&lt;/code&gt; that exposes the &lt;code&gt;invoke()&lt;/code&gt; method. The members of our instance are depicted as &lt;code&gt;Symbol&lt;/code&gt; types. The example above invokes the handle method by passing its &lt;code&gt;Symbol&lt;/code&gt;ic name along with an array of positional arguments if any are specified.&lt;/p&gt;

&lt;p&gt;To pass arguments across, let's modify the signature of the &lt;code&gt;handle()&lt;/code&gt; method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;handle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Request received &lt;/span&gt;&lt;span class="si"&gt;$a&lt;/span&gt;&lt;span class="s"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And pass this to the invocation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;reflectedClass&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;invoke&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Symbol&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'handle'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'argument 1'&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;span class="c1"&gt;// =&amp;gt; Request received argument 1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can use the literal form of the &lt;code&gt;handle()&lt;/code&gt; method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;reflectedClass&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;invoke&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;#handle&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'argument 1'&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can use the &lt;code&gt;Symbol('methodName')&lt;/code&gt; approach if the method name is received as a value from an operation or provided as user input. &lt;em&gt;Ideally when you &lt;strong&gt;don't&lt;/strong&gt; know beforehand the method to invoke.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Watch the video above for the full tutorial.&lt;/p&gt;

&lt;p&gt;→ &lt;a href="https://gist.github.com/graphicbeacon/9fb6c6a951168d6a31d9b2cc442bcbe2"&gt;&lt;strong&gt;Get the source code&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Further reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://api.dart.dev/stable/2.4.0/dart-mirrors/dart-mirrors-library.html"&gt;&lt;strong&gt;dart:mirrors&lt;/strong&gt; library documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://creativebracket.com/dart-and-mongodb-tutorial-1"&gt;Dart and MongoDB Tutorial #1: Using the mongo_dart package&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  One last thing...
&lt;/h2&gt;

&lt;p&gt;I'm glad to announce that I've hit &lt;strong&gt;over 7000 followers&lt;/strong&gt; on dev.to. Thanks a lot for all the growing interest, support and the feedback I've received!&lt;/p&gt;

&lt;p&gt;In light of that I'm launching the &lt;a href="////bit.ly/creativebracketmerch"&gt;&lt;strong&gt;Official Merch Store&lt;/strong&gt;&lt;/a&gt; today. It's a great opportunity to be a part of the movement and keep the flames🔥 lit. That would drive the production of high-quality content covering topics further than "hello world" apps.&lt;/p&gt;

&lt;p&gt;I've also hit over 800 subscribers on the YouTube channel. &lt;a href="https://youtube.com/CreativeBracket"&gt;&lt;strong&gt;Hit that subscribe and bell notification&lt;/strong&gt;&lt;/a&gt; if you haven't already. I plan on doing a series on code generation among other things quite soon.&lt;/p&gt;

&lt;p&gt;Lastly, there are more tutorials on my blog at &lt;a href="https://creativebracket.com"&gt;creativebracket.com&lt;/a&gt;. Do check 'em out.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Like, share and follow&lt;/strong&gt; me for more content on Dart. &lt;em&gt;Thanks.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>dart</category>
      <category>showdev</category>
      <category>webdev</category>
      <category>codequality</category>
    </item>
    <item>
      <title>10 interesting Dart and CSS libraries for May 2019</title>
      <dc:creator>Jermaine</dc:creator>
      <pubDate>Sat, 04 May 2019 10:34:43 +0000</pubDate>
      <link>https://dev.to/creativ_bracket/10-interesting-dart-and-css-libraries-for-may-2019-29l9</link>
      <guid>https://dev.to/creativ_bracket/10-interesting-dart-and-css-libraries-for-may-2019-29l9</guid>
      <description>&lt;p&gt;Dart has hit another win lately, having been listed at &lt;a href="https://insights.stackoverflow.com/survey/2019#most-loved-dreaded-and-wanted"&gt;#12 of the most loved languages&lt;/a&gt; according to the StackOverflow 2019 Annual Developer Survey. In light of that I have taken a look and hand-picked 10 of the most interesting Dart packages you can start working with along side CSS libraries you should shortlist for your next web project.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. &lt;a href="https://pub.dartlang.org/packages/dio"&gt;dio&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://pub.dartlang.org/packages/dio"&gt;Dio&lt;/a&gt; is a powerful library for making HTTP requests. It wraps Dart’s HttpClient class while extending it with support for features such as Interceptors, File Download, Request Cancellation, Timeout and several more. It can be configured globally and its super simple to use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:dio/dio.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="kd"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Response&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;Dio&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'https://news.ycombinator.com'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. &lt;a href="https://bulma.io/"&gt;BulmaCSS&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://bulma.io/"&gt;Bulma&lt;/a&gt; is a free, open source CSS framework based on Flexbox and used by more than 150,000 developers, including myself. It provides helper classes for styling various UI elements while adopting a mobile-first responsive design approach. In fact I’ve worked with Bulma in &lt;a href="https://creativebracket.com/build-a-chat-application-in-dart-part-1/"&gt;this tutorial series&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. &lt;a href="https://pub.dartlang.org/packages/rxdart"&gt;RxDart&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://pub.dartlang.org/packages/rxdart"&gt;RxDart&lt;/a&gt; is a reactive functional programming library based on the ReactiveX JS counterpart. It’s one of the go-to solutions for state management in Flutter mobile apps, although it also works on server and web. RxDart builds on top of Dart’s pretty decent Streams API with extra functionality.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. &lt;a href="https://github.com/kognise/water.css"&gt;Water.css&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/kognise/water.css"&gt;Water.css&lt;/a&gt; is a &lt;em&gt;just-add-css&lt;/em&gt; collection of styles to make simple websites just a little nicer. It can easily be activated by sticking the CSS file in your &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; section:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://cdn.jsdelivr.net/gh/kognise/water.css@latest/dist/dark.css"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. &lt;a href="https://pub.dartlang.org/packages/html"&gt;html&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://pub.dartlang.org/packages/html"&gt;&lt;strong&gt;html&lt;/strong&gt;&lt;/a&gt; is a pure Dart HTML5 parser. It’s a port of html5lib from Python. It’s got a straight-forward API and a useful application when &lt;a href="https://creativebracket.com/write-your-first-web-scraper/"&gt;writing web scrapers&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. &lt;a href="https://daneden.github.io/animate.css/"&gt;animate.css&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://daneden.github.io/animate.css"&gt;&lt;strong&gt;Animate.css&lt;/strong&gt;&lt;/a&gt; provides &lt;em&gt;just-add-water&lt;/em&gt; CSS animations, simples! It’s got effects for bounce, pulse, shake and several more.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. &lt;a href="https://pub.dartlang.org/packages/markdown"&gt;markdown&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://pub.dartlang.org/packages/markdown"&gt;&lt;strong&gt;markdown&lt;/strong&gt;&lt;/a&gt; is a portable Markdown library written in Dart. It can parse Markdown into HTML on both web and server. Points for whoever can combine this with the &lt;strong&gt;html&lt;/strong&gt; library. Try it out at &lt;a href="https://dartlang.github.io/markdown"&gt;https://dartlang.github.io/markdown&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. &lt;a href="https://www.vittoriozaccaria.net/dyn-css/"&gt;DynCSS&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.vittoriozaccaria.net/dyn-css/"&gt;&lt;strong&gt;DynCSS&lt;/strong&gt;&lt;/a&gt; parses your css for &lt;code&gt;-dyn-(attribute)&lt;/code&gt; rules and then evaluates then via JS on browser events like &lt;code&gt;scroll&lt;/code&gt; and &lt;code&gt;resize&lt;/code&gt;. The result is applied to the CSS attribute you have specific in the &lt;code&gt;(attribute)&lt;/code&gt; sufix. For the most part you only need to set CSS property/value pairs, but there also a JS API for custom functions, which can be accessed from Dart 🎯😉. Here’s of &lt;a href="https://www.vittoriozaccaria.net/dyncss-example/"&gt;demo&lt;/a&gt; of this at work.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. &lt;a href="https://pub.dartlang.org/packages/pdf"&gt;pdf&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://pub.dartlang.org/packages/pdf"&gt;&lt;strong&gt;pdf&lt;/strong&gt;&lt;/a&gt; creates PDF files for web and Flutter projects. It can create full multi-page documents with graphics, images and text using TrueType fonts. The library provides a low-level PDF creation utility that takes care of the bits generation and a Widget system similar to Flutter’s, for easy high-level PDF creation.&lt;/p&gt;

&lt;p&gt;Example code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;pdf&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Document&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;addPage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Page&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nl"&gt;pageFormat:&lt;/span&gt; &lt;span class="n"&gt;PdfPageFormat&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;a4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;build:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Context&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;Center&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nl"&gt;child:&lt;/span&gt; &lt;span class="n"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello World"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Center&lt;/span&gt;
    &lt;span class="p"&gt;}));&lt;/span&gt; &lt;span class="c1"&gt;// Page&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  10. &lt;a href="http://ianlunn.github.io/Hover/"&gt;Hover.css&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="http://ianlunn.github.io/Hover/"&gt;&lt;strong&gt;Hover.css&lt;/strong&gt;&lt;/a&gt; provides a collection of CSS3 powered hover effects to be applied to links, buttons, logos, SVG, featured images and so on. It can be applied to your own elements and modified too. Available in CSS, SASS and LESS.&lt;/p&gt;




&lt;h2&gt;
  
  
  Sharing is caring
&lt;/h2&gt;

&lt;p&gt;If you enjoyed reading this post, please share this through the various social buttons on this page. Also, check out and &lt;a href="https://youtube.com/c/CreativeBracket"&gt;&lt;strong&gt;subscribe to my YouTube channel&lt;/strong&gt;&lt;/a&gt; (&lt;em&gt;hit the bell icon too&lt;/em&gt;) for videos on Dart with &lt;em&gt;Angular, Vue, React, HTTP, RESTful APIs, MongoDB&lt;/em&gt; and many more.&lt;/p&gt;

&lt;p&gt;Visit &lt;a href="https://creativebracket.com"&gt;&lt;strong&gt;creativebracket.com&lt;/strong&gt;&lt;/a&gt; for more in-depth Dart tutorials.&lt;/p&gt;

</description>
      <category>dart</category>
      <category>css</category>
      <category>beginners</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Build a chat application in Dart (Part 3)</title>
      <dc:creator>Jermaine</dc:creator>
      <pubDate>Wed, 10 Apr 2019 10:09:21 +0000</pubDate>
      <link>https://dev.to/creativ_bracket/build-a-chat-application-in-dart-part-3-1bm5</link>
      <guid>https://dev.to/creativ_bracket/build-a-chat-application-in-dart-part-3-1bm5</guid>
      <description>&lt;p&gt;In &lt;a href="https://creativebracket.com/build-a-chat-application-in-dart-3/" rel="noopener noreferrer"&gt;Part 2&lt;/a&gt; we refactored our solution by splitting the Sign in and Chat room logic into &lt;code&gt;View&lt;/code&gt; classes, building a &lt;code&gt;Router&lt;/code&gt; object to transition between the screens. We will complete the full flow here by implementing our WebSocket connection and managing each of the chatters in our Chat room. At the end of this tutorial we will have a functioning chat application.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Create a WebSocket object
&lt;/h2&gt;

&lt;p&gt;In order for messages to be relayed from one user and broadcasted to the others, we need to establish a persistent, bi-directional connection to our server. This will allow messages to be sent back and forth between the server and client using an event-based architecture. This is made possible via the WebSocket protocol, which the &lt;strong&gt;dart:io&lt;/strong&gt; and &lt;strong&gt;dart:html&lt;/strong&gt; library provides classes for. &lt;em&gt;So no external packages needed!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let's begin on the client by writing a class to be responsible for instantiating a &lt;code&gt;WebSocket&lt;/code&gt; object and implementing various event listeners on them. This class will represent a user's connection to our Chat room server.&lt;/p&gt;

&lt;h3&gt;
  
  
  Build a Chat room subject
&lt;/h3&gt;

&lt;p&gt;Create a &lt;code&gt;chat_room_subject.dart&lt;/code&gt; file inside the directory &lt;code&gt;lib/src&lt;/code&gt; and implement the class for our &lt;code&gt;ChatRoomSubject&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="c1"&gt;// lib/src/chat_room_subject.dart&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'dart:html'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ChatRoomSubject&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;ChatRoomSubject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;

  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;WebSocket&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because we've marked our &lt;code&gt;socket&lt;/code&gt; instance variable as &lt;strong&gt;final&lt;/strong&gt;, it requires that we assign a value to it in the initialize phase, that is, before the &lt;code&gt;{}&lt;/code&gt; part of our constructor is run. Let's therefore create our &lt;code&gt;WebSocket&lt;/code&gt; instance and pass the URL to our server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;ChatRoomSubject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;WebSocket&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'ws://localhost:9780/ws?username=&lt;/span&gt;&lt;span class="si"&gt;$username&lt;/span&gt;&lt;span class="s"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When our &lt;code&gt;WebSocket&lt;/code&gt; class is instantiated, a connection will be established to the URL passed in as it's &lt;code&gt;String&lt;/code&gt; argument. We've also passed in the username value as part of the query string of the &lt;code&gt;WebSocket&lt;/code&gt; URL.&lt;/p&gt;

&lt;p&gt;We are now able to listen for several events on our &lt;code&gt;WebSocket&lt;/code&gt; namely &lt;strong&gt;open&lt;/strong&gt;, &lt;strong&gt;message&lt;/strong&gt;, &lt;strong&gt;error&lt;/strong&gt; and &lt;strong&gt;close&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ..&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ChatRoomSubject&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// ..&lt;/span&gt;
  &lt;span class="c1"&gt;// ..&lt;/span&gt;
  &lt;span class="n"&gt;_initListeners&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;onOpen&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;evt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Socket is open'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="c1"&gt;// Please note: "message" event will be implemented elsewhere&lt;/span&gt;

    &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;onError&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;evt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Problems with socket. &lt;/span&gt;&lt;span class="si"&gt;${evt}&lt;/span&gt;&lt;span class="s"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;onClose&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;evt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Socket is closed'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And we need to invoke the &lt;code&gt;_initListeners()&lt;/code&gt; method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;ChatRoomSubject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;WebSocket&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'ws://localhost:9780/ws?username=&lt;/span&gt;&lt;span class="si"&gt;$username&lt;/span&gt;&lt;span class="s"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;_initListeners&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// &amp;lt;-- Added this line&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We need to be able to send messages to our Chat room server and close a WebSocket connection, effectively leaving the Chat room. Add these methods to our &lt;code&gt;ChatRoomSubject&lt;/code&gt; class before &lt;code&gt;_initListeners()&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;close&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Integrate &lt;code&gt;ChatRoomSubject&lt;/code&gt; into the &lt;code&gt;ChatRoomView&lt;/code&gt; class
&lt;/h3&gt;

&lt;p&gt;Import the dart file we've just created from web/views/chat_room.dart directly after our &lt;code&gt;// Absolute imports&lt;/code&gt; (&lt;code&gt;dart_bulma_chat_app&lt;/code&gt; is a reference to the name value field inside your pubspec.yaml file, which points to the &lt;code&gt;lib/&lt;/code&gt; directory):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="c1"&gt;// web/views/chat_room.dart&lt;/span&gt;

&lt;span class="c1"&gt;// Absolute imports&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'dart:html'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'dart:convert'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Package imports&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:dart_bulma_chat_app/src/chat_room_subject.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// &amp;lt;-- Added this line&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And then we will instantiate this class as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ..&lt;/span&gt;
&lt;span class="c1"&gt;// ..&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ChatRoomView&lt;/span&gt; &lt;span class="kd"&gt;implements&lt;/span&gt; &lt;span class="n"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;ChatRoomView&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;params&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;_contents&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;DocumentFragment&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
        &lt;span class="n"&gt;_subject&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ChatRoomSubject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'username'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="c1"&gt;// &amp;lt;-- Added this line&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;onEnter&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;/// Properties&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;ChatRoomSubject&lt;/span&gt; &lt;span class="n"&gt;_subject&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// ..&lt;/span&gt;
  &lt;span class="c1"&gt;// ..&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you look at the &lt;code&gt;_initListeners()&lt;/code&gt; method in &lt;code&gt;ChatRoomSubject&lt;/code&gt; you should notice that we didn't implement the listener for the WebSocket "&lt;strong&gt;message&lt;/strong&gt;" event. We will do that in &lt;code&gt;ChatRoomView&lt;/code&gt; since we have access to the &lt;code&gt;WebSocket&lt;/code&gt; instance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ..&lt;/span&gt;
&lt;span class="c1"&gt;// ..&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ChatRoomView&lt;/span&gt; &lt;span class="kd"&gt;implements&lt;/span&gt; &lt;span class="n"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// ..&lt;/span&gt;
  &lt;span class="c1"&gt;// ..&lt;/span&gt;
  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;_addEventListeners&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// ..&lt;/span&gt;
    &lt;span class="c1"&gt;// ..&lt;/span&gt;
    &lt;span class="n"&gt;_subject&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;socket&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;onMessage&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_subjectMessageHandler&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;_subjectMessageHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;evt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;chatRoomLog&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;appendHtml&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;evt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;data&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;'&amp;lt;br /&amp;gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lastly, let's amend &lt;code&gt;_sendBtnClickHandler(e)&lt;/code&gt; to send messages from the input field to the Chat server, empty the message input field value and reset it's focus:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;_sendBtnClickHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;_subject&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;messageField&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;// Resets value and re-focuses on input field&lt;/span&gt;
  &lt;span class="n"&gt;messageField&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;''&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;focus&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Upgrade incoming requests to WebSocket connections
&lt;/h2&gt;

&lt;p&gt;To get a basic example working, let's write some server-side logic to maintain our chat room session.&lt;/p&gt;

&lt;p&gt;Create &lt;code&gt;lib/src/chat_room_session.dart&lt;/code&gt; and implement the class for our &lt;code&gt;ChatRoomSession&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'dart:io'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'dart:convert'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Chatter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;Chatter&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;session&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="n"&gt;HttpSession&lt;/span&gt; &lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;WebSocket&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ChatRoomSession&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Chatter&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;_chatters&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;

  &lt;span class="c1"&gt;// TODO: Implement addChatter method&lt;/span&gt;
  &lt;span class="c1"&gt;// TODO: Implement removeChatter method&lt;/span&gt;
  &lt;span class="c1"&gt;// TODO: Implement notifyChatters method&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we have two different classes. The &lt;code&gt;Chatter&lt;/code&gt; class represents each participant. This participant contains its current session, WebSocket connection and name. The &lt;code&gt;ChatRoomSession&lt;/code&gt; class manages our list of participants, including facilitating communication between them.&lt;/p&gt;

&lt;p&gt;Here's the implementation of the &lt;code&gt;addChatter()&lt;/code&gt; method. This upgrades the incoming request to a WebSocket connection, builds a &lt;code&gt;Chatter&lt;/code&gt; object, creates event listeners and adds it to the &lt;code&gt;_chatters&lt;/code&gt; list:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ChatRoomSession&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="kt"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Chatter&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;_chatters&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;

  &lt;span class="n"&gt;addChatter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;HttpRequest&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kd"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Upgrade request to `WebSocket` connection and add to `Chatter` object&lt;/span&gt;
    &lt;span class="n"&gt;WebSocket&lt;/span&gt; &lt;span class="n"&gt;ws&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;WebSocketTransformer&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;upgrade&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;Chatter&lt;/span&gt; &lt;span class="n"&gt;chatter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Chatter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="nl"&gt;session:&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;session&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;socket:&lt;/span&gt; &lt;span class="n"&gt;ws&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;name:&lt;/span&gt; &lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Listen for incoming messages, handle errors and close events&lt;/span&gt;
    &lt;span class="n"&gt;chatter&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;socket&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;_handleMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chatter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="nl"&gt;onError:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Error with socket &lt;/span&gt;&lt;span class="si"&gt;${err.message}&lt;/span&gt;&lt;span class="s"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="nl"&gt;onDone:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;_removeChatter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chatter&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="n"&gt;_chatters&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chatter&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'[ADDED CHATTER]: &lt;/span&gt;&lt;span class="si"&gt;${chatter.name}&lt;/span&gt;&lt;span class="s"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// TODO: Implement _handleMessage method&lt;/span&gt;
  &lt;span class="n"&gt;_handleMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Chatter&lt;/span&gt; &lt;span class="n"&gt;chatter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When messages are sent to the server via the connection, we handle this by invoking &lt;code&gt;_handleMessage()&lt;/code&gt; while passing it the &lt;code&gt;Chatter&lt;/code&gt; object and &lt;code&gt;data&lt;/code&gt; as arguments. &lt;/p&gt;

&lt;p&gt;Let's cross out that &lt;code&gt;// TODO:&lt;/code&gt; by implementing &lt;code&gt;_handleMessage()&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;_handleMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Chatter&lt;/span&gt; &lt;span class="n"&gt;chatter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;chatter&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;socket&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'You said: &lt;/span&gt;&lt;span class="si"&gt;$data&lt;/span&gt;&lt;span class="s"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="n"&gt;_notifyChatters&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chatter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And let's implement &lt;code&gt;_notifyChatters()&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;_notifyChatters&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Chatter&lt;/span&gt; &lt;span class="n"&gt;exclude&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;_chatters&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;where&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;chatter&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;chatter&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;exclude&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;toList&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;chatter&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;chatter&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;socket&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And also removing the &lt;code&gt;Chatter&lt;/code&gt; object when a participant leaves:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;_removeChatter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Chatter&lt;/span&gt; &lt;span class="n"&gt;chatter&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'[REMOVING CHATTER]: &lt;/span&gt;&lt;span class="si"&gt;${chatter.name}&lt;/span&gt;&lt;span class="s"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="n"&gt;_chatters&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;removeWhere&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;chatter&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="n"&gt;_notifyChatters&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chatter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'&lt;/span&gt;&lt;span class="si"&gt;${chatter.name}&lt;/span&gt;&lt;span class="s"&gt; has left the chat.'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Instantiate our &lt;code&gt;ChatRoomSession&lt;/code&gt; class
&lt;/h3&gt;

&lt;p&gt;Go to &lt;code&gt;bin/server.dart&lt;/code&gt; and create our instance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'dart:io'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'dart:convert'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="s"&gt;'package:dart_bulma_chat_app/src/chat_room_session.dart'&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// &amp;lt;-- Added this line&lt;/span&gt;

&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="kd"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// TODO: Get port from environment variable&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;port&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;9780&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;server&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;HttpServer&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;InternetAddress&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;loopbackIPv4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;chatRoomSession&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ChatRoomSession&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// &amp;lt;-- Added this line&lt;/span&gt;
  &lt;span class="c1"&gt;// ..&lt;/span&gt;
  &lt;span class="c1"&gt;// ..&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Scroll down to the &lt;code&gt;case '/ws':&lt;/code&gt; section and call the &lt;code&gt;addChatter()&lt;/code&gt; method, passing it the request and username:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ..&lt;/span&gt;
&lt;span class="c1"&gt;// .. &lt;/span&gt;
  &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s"&gt;'/ws'&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
    &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;username&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;uri&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;queryParameters&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'username'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="n"&gt;chatRoomSession&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;addChatter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// ..&lt;/span&gt;
&lt;span class="c1"&gt;// ..&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So we retrieve the &lt;strong&gt;username&lt;/strong&gt; from the query parameters when we passed &lt;code&gt;?username=$username&lt;/code&gt; into the URL we defined for our &lt;code&gt;WebSocket&lt;/code&gt; instance inside &lt;code&gt;ChatRoomSubject&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Let us test what we have now. Open a terminal session and instantiate the server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dart bin/server.dart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And run the web app on another terminal session:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;webdev serve &lt;span class="nt"&gt;--live-reload&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Following this fully should give you the image result below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F62b00xpcf7lzr11vnl0i.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F62b00xpcf7lzr11vnl0i.gif" alt="Chat app working demo" width="1161" height="610"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you’ve got this far then great job!!!&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Implement some helper functions
&lt;/h2&gt;

&lt;p&gt;We need a way of categorising the types of messages sent to our Chat server and respond to it accordingly. When a participant joins the chat, it would be great to send a notification welcoming this new participant and notifying the other participants on the new chatter. We will create an enum type which will contain the particular types of messages this Chat app will have. &lt;/p&gt;

&lt;p&gt;Follow the full tutorial which includes tidying up the look and feel of the chat messages and implementing the logout functionality. &lt;/p&gt;

&lt;p&gt;→ &lt;a href="https://creativebracket.com/build-a-chat-application-in-dart-3/" rel="noopener noreferrer"&gt;&lt;strong&gt;Read the full tutorial on my blog&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Sharing is caring 🤗
&lt;/h2&gt;

&lt;p&gt;If you enjoyed reading this post, please share this through the various social channels. I'm looking for some Patrons to keep these detailed articles coming. &lt;a href="https://patreon.com/creativebracket" rel="noopener noreferrer"&gt;&lt;strong&gt;Become a Patron&lt;/strong&gt;&lt;/a&gt; today...it will really make my day. Alternatively, you could &lt;a href="https://ko-fi.com/creativebracket" rel="noopener noreferrer"&gt;&lt;strong&gt;buy me a coffee&lt;/strong&gt;&lt;/a&gt; instead.&lt;/p&gt;

&lt;p&gt;Watch my &lt;a href="https://egghead.io/courses/get-started-with-dart" rel="noopener noreferrer"&gt;Free &lt;strong&gt;Get started with Dart&lt;/strong&gt; course&lt;/a&gt; on Egghead.io and &lt;a href="http://eepurl.com/gipQBX" rel="noopener noreferrer"&gt;&lt;strong&gt;Subscribe to my email newsletter&lt;/strong&gt;&lt;/a&gt; to download my Free 35-page &lt;strong&gt;Get started with Dart&lt;/strong&gt; eBook and to be notified when new content is released.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Like, share and &lt;a href="https://twitter.com/creativ_bracket" rel="noopener noreferrer"&gt;follow me&lt;/a&gt;&lt;/strong&gt; 😍 for more content on Dart.&lt;/p&gt;

</description>
      <category>dart</category>
      <category>http</category>
      <category>beginners</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
