<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Paulina Szklarska on Medium]]></title>
        <description><![CDATA[Stories by Paulina Szklarska on Medium]]></description>
        <link>https://medium.com/@pszklarska?source=rss-bfb18d52883e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*F1pGHecPoNsOvs8cRUrmbA.png</url>
            <title>Stories by Paulina Szklarska on Medium</title>
            <link>https://medium.com/@pszklarska?source=rss-bfb18d52883e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 12 Nov 2026 08:11:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pszklarska/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Speed up writing Flutter Redux code in your IDE]]></title>
            <link>https://itnext.io/speed-up-writing-flutter-redux-code-in-your-ide-e29a355684ad?source=rss-bfb18d52883e------2</link>
            <guid isPermaLink="false">https://medium.com/p/e29a355684ad</guid>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Paulina Szklarska]]></dc:creator>
            <pubDate>Mon, 05 Jul 2021 10:56:00 GMT</pubDate>
            <atom:updated>2021-07-05T10:56:24.681Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi! 👋</p><p>If you’re developing your Flutter application using Redux, you know that this architecture has many advantages. Unfortunately, like everything, it also has some drawbacks. One of them is the amount of code you have to write for every new widget that wants to benefit from the Redux Store.</p><p>Today I’d like to show you a nice way for speeding up this process. It’ll be useful for you if you’re using <strong>Android Studio</strong>, <strong>IntelliJ IDEA</strong> or <strong>Visual Studio Code.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E0-WHHqSXnWkeyo1Drqn_A.gif" /></figure><h3>Android Studio/IntelliJ IDEA</h3><p>In this IDE we’re gonna use a feature called <strong>Live Template</strong>. To create a new Live Template, go to the <strong>Settings/Preferences | Editor | Live Templates.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xwLP1BB5xq9KjiXYRzZVcA.png" /></figure><p>In the editor window, tap on the + icon and add a new <strong>Live Template. </strong>Fill in the <strong>abbreviation</strong> you want to use for your template (it’s <em>redux</em> in my case) and the <strong>description</strong>. Paste the following text in the <strong>Template text</strong> field.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/35e167907e90b545e443239b84b3822b/href">https://medium.com/media/35e167907e90b545e443239b84b3822b/href</a></iframe><p>Under the Template text field, select <strong>Define… </strong>to choose a context to which template can be applied to and select <strong>Dart: top-level</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x56Vsnjux5107I61gtNkRg.png" /></figure><p>That’s it! To start using it, open any dart file and start typing <em>redux. </em>That should show your new Redux template.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dW5azB3iYoGZrcw43t34fQ.png" /></figure><blockquote>To read more about Live Templates, visit <a href="https://www.jetbrains.com/help/idea/using-live-templates.html">IntelliJ IDEA documentation</a></blockquote><h3>Visual Studio Code</h3><p>In this IDE we’ll use a feature called <strong>Snippets</strong>. To create a new Snippet, go to the <strong>File/Code | Preferences | User Snippets.</strong></p><p>In the window that’ll appear, choose <strong>dart.</strong> That should open the editor for your snippet. Paste the following code into that editor and save it:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a9e503caab592cb4247bd9cb710387ee/href">https://medium.com/media/a9e503caab592cb4247bd9cb710387ee/href</a></iframe><p>To use it, open one of your dart files and start typing <em>redux. </em>That should highlight your new Snippet:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LLHDGpazI_X7laa4FMLESQ.png" /></figure><blockquote>To read more about Snippets, visit <a href="https://code.visualstudio.com/docs/editor/userdefinedsnippets">Visual Studio Code documentation</a></blockquote><h3>Summary</h3><p>To summarise, today I showed you how you can use <strong>Live Templates</strong> or <strong>Snippets </strong>to speed up your work. You can use them for many other things, including frequently used utility methods or the boilerplate code. Let me know in the comments about your ideas!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e29a355684ad" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/speed-up-writing-flutter-redux-code-in-your-ide-e29a355684ad">Speed up writing Flutter Redux code in your IDE</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running Flutter integration tests on Firebase Test Lab]]></title>
            <link>https://itnext.io/running-flutter-integration-tests-on-firebase-test-lab-820b57af7cd2?source=rss-bfb18d52883e------2</link>
            <guid isPermaLink="false">https://medium.com/p/820b57af7cd2</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[firebase]]></category>
            <dc:creator><![CDATA[Paulina Szklarska]]></dc:creator>
            <pubDate>Wed, 03 Feb 2021 07:42:42 GMT</pubDate>
            <atom:updated>2021-02-03T07:42:42.727Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HahwMrAD9e7rJJ8p" /><figcaption>Photo by <a href="https://unsplash.com/@rmrdnl?utm_source=medium&amp;utm_medium=referral">Daniel Romero</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Hi! Today I’d like to show you how to run Flutter integration tests on devices using Firebase Test Lab.</p><h4>What are integration tests?</h4><p>Integration tests check how different parts of the app work together. Unlike unit tests, they are intended to be run on devices (physical or virtual) and are used for <strong>end-to-end testing</strong> instead of testing particular components in separation. Because of that, integrations tests are much slower than unit tests, but they are a great way to check if our app works correctly in real-life scenarios.</p><h4>What is a Firebase Test Lab?</h4><p>While running integrations tests is a great way of testing the app, we’re unfortunately limited to the devices we have. They can be either physical devices, emulators or simulators, but we have to setup each one of them to run tests on our machine. That can become problematic if we’d like to test it on many different devices.</p><p>With <strong>Firebase Test Lab</strong>, we have access to<strong> thousands of Google-hosted devices</strong> with different device configurations. They are all stored in a cloud, so we can have remote access to them. All we have to do is to upload our app’s tests and Firebase will run them for us.</p><h3>Pre-requisites</h3><p>For this example, I’m going to use the default counter app that’s generated when you run flutter create command.</p><p>If you want to follow these steps along the way, you can check out this repository’s branch: <a href="https://github.com/pszklarska/flutter_integration_testing/tree/05ce78deb3ea410e46a4532e94ffdeff27077315">flutter_integration_testing</a></p><h3>Setup</h3><p>We’re gonna start with adding a dependency in the <em>pubspec.yaml</em> to dev_dependencies section. That’s the section where all dependencies for non-production code should be put.</p><p>We’ll use <a href="https://pub.dev/packages/integration_test">integration_test</a> package. To install it, add this to your <em>pubspec.yaml</em>:</p><pre>dev_dependencies:<br>  flutter_test:<br>    sdk: flutter<br>  integration_test: ^1.0.2+2</pre><h3>Add integrations tests support</h3><p>To add support for integration testing, the first thing to do is to add method IntegrationTestWidgetsFlutterBinding.<em>ensureInitialized</em>() in your test. This method is needed to initialize the Flutter test environment.</p><p>In my case, I’m going to add it in the <em>test/widget_test.dart</em> file. That’s the basic widget test added to the counter app on start that checks if the text is updated on the screen whenever we tap ‘+’ button:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0614b2c64ed43de3bd642a70eeae1591/href">https://medium.com/media/0614b2c64ed43de3bd642a70eeae1591/href</a></iframe><blockquote>Full source code: <a href="https://github.com/pszklarska/flutter_integration_testing/blob/master/test/widget_test.dart">widget_test.dart</a></blockquote><h3>Running test on your machine</h3><p>To run the test on your machine, you have to first create an entry point for test driver script. To do that, create a new file in <em>test_driver/integration_test.dart </em>and paste it:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c5b5fd8c62a6461b4ef82a3dc37b69ec/href">https://medium.com/media/c5b5fd8c62a6461b4ef82a3dc37b69ec/href</a></iframe><blockquote>Full source code: <a href="https://github.com/pszklarska/flutter_integration_testing/blob/master/test_driver/integration_test.dart">integration_test.dart</a></blockquote><p>That file can then be used to run flutter drive command and run all tests from <em>test/widget_integration_test.dart. </em>Remember that flutter drive runs test on your device, so you should have one already running!</p><pre>flutter drive \<br> --driver=test_driver/integration_test.dart \<br> --target=test/widget_integration_test.dart</pre><p>As the result, you should see that your app is installed, tests are running quickly and later on you’ll see test results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s-YKW2zlrc9o0OZYuXFzmw.png" /></figure><h3>Running tests on Firebase Test Lab</h3><p>If you haven’t already done it, you can start with creating <a href="http://console.firebase.google.com/">new Firebase project in the console</a>. You don’t have to setup Android &amp; iOS apps, you can finish when you see that screen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KFMNKM-h3DZVhOIDj0FPgw.png" /></figure><p>Now you can go and setup either Android, iOS, or both apps and prepare them to upload to Firebase Test Lab.</p><p><em>Note: This article describes uploading Android versions. If you’d like to see how to setup iOS, check out this </em><a href="https://pub.dev/packages/integration_test#ios-device-testing"><em>integration_test</em></a><em> package documentation.</em></p><h4>Android setup</h4><p>To setup Android, you have to create a new file in <em>android/app/src/androidTest/java/your/package/yourapp/MainActivityTest.java</em> directory. That /java/your/package/yourapp path should be replaced with your path:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ee1b7bcfd313c04246d8771c362466e9/href">https://medium.com/media/ee1b7bcfd313c04246d8771c362466e9/href</a></iframe><blockquote>Full source code: <a href="https://github.com/pszklarska/flutter_integration_testing/blob/master/android/app/src/androidTest/java/com/pszklarska/flutter_integration_test/MainActivityTest.java">MainActivityTest.java</a></blockquote><p>And the last thing is to add dependencies for android testing in <em>android/app/build.gradle</em> file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/25f0fdb8152377862c58bab593009278/href">https://medium.com/media/25f0fdb8152377862c58bab593009278/href</a></iframe><blockquote>Full source code: <a href="https://github.com/pszklarska/flutter_integration_testing/blob/master/android/app/build.gradle">build.gradle</a></blockquote><p>After this setup, you can prepare the instrumentation test build with the following command:</p><pre>pushd android<br>flutter build apk<br>./gradlew app:assembleAndroidTest<br>./gradlew app:assembleDebug -Ptarget=test/widget_test.dart<br>popd</pre><p>That should generate file in <em>/build/app/outputs/apk/debug/app-debug.apk. </em>Take that file and drag it (or upload) into the Firebase console in the Test Lab tab:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dcb2F4eVEeZhx36JHsF1qA.png" /></figure><p>This will automatically start Robo testing. That’s another test type that you can explore, but we’re not gonna focus on that today. Instead, we’ll go to running our integration tests.</p><p>To do that, click on <em>“Run a test”</em> and choose <em>“Instrumentation”</em>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0dm_ZzWG7YHSmqE1vCROrQ.png" /></figure><p>On the next screen you should upload two previously generated APKs:</p><ol><li>App APK is located in <em>/build/app/outputs/apk/debug/app-debug.apk</em></li><li>Test App is located in <em>/build/app/outputs/apk/androidTest/app-debug-androidTest.apk</em></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0LOC43qrqjA29xty7xhD-Q.png" /></figure><p>After they are uploaded, on the next screen you can choose on which devices you want to run integration tests:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v1Dd_y7RmVqpezQpdh2Sog.png" /></figure><p>After selecting devices and continuing, your tests will start to run. After a few minutes you’ll see the results. If everything is ok you should see this screen with green success!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IJRLBsG-orYG873m2BtlDA.png" /></figure><p>If you’ll have some test failures, you’ll see them here too.</p><p>And that’s it! If you want to check out the full source code, visit my repository:</p><p><a href="https://github.com/pszklarska/flutter_integration_testing">pszklarska/flutter_integration_testing</a></p><p>I hope you liked this article. If you want to read more of my articles, don’t forget to follow me. Stay tuned for more! 🙌</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=820b57af7cd2" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/running-flutter-integration-tests-on-firebase-test-lab-820b57af7cd2">Running Flutter integration tests on Firebase Test Lab</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Top 5 most useful keyboard shortcuts in IntelliJ IDEA]]></title>
            <link>https://medium.com/code-well/top-5-most-used-keyboard-shortcuts-in-intellij-idea-f43e18eca833?source=rss-bfb18d52883e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f43e18eca833</guid>
            <category><![CDATA[programming-languages]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Paulina Szklarska]]></dc:creator>
            <pubDate>Mon, 25 Jan 2021 11:37:52 GMT</pubDate>
            <atom:updated>2021-01-26T06:06:35.261Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AxEtuhYA-XwSmwax" /><figcaption>Photo by <a href="https://unsplash.com/@ovia014?utm_source=medium&amp;utm_medium=referral">Aleksandra Wantuch</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Hi! Today I’d like to share my favourites keyboard shortcuts I can’t imagine living without.</p><p>A few years ago I wrote two articles about keyboard shortcuts in Android Studio. They can be also applied to IntelliJ IDEA, so if you don’t know them, give it a reading!</p><ul><li><a href="https://codeburst.io/top-unknown-keyboard-shortcuts-in-android-studio-7b1bf833c9f1">Top (unknown) keyboard shortcuts in Android Studio</a></li><li><a href="https://android.jlelse.eu/top-unknown-keyboard-shortcuts-in-android-studio-part-ii-c921d7781d09">Top (unknown) keyboard shortcuts in Android Studio — Part II</a></li></ul><p>Today, I’d like to share those who might be more obvious, but for those of you who don’t know them —I’m sure they’ll save you plenty of time and mouse clicking! Let’s start!</p><h3>#1 Go to declaration</h3><p>That’s my №1 shortcut, my all-time-favourite! With this shortcut, you can easily find all places where a class is declared. Super helpful when you want to check what are the occurrences of a specific class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fNuklPmIjeuBgbRAiulTAQ.png" /><figcaption>Tap on a name and go to a declaration with a shortcut</figcaption></figure><p>Just tap on a class name and use the shortcut:</p><p><strong>macOS</strong>: Cmd + B</p><p><strong>windows</strong>: Ctrl + B</p><p>More info: <a href="https://www.jetbrains.com/help/idea/navigating-through-the-source-code.html?keymap=secondary_macos#go_to_declaration">IntelliJ IDEA — Go to declaration and its type</a></p><h3>#2 Find a class by name</h3><p>Another very frequently used by me shortcut is for finding a class by its name. It’s very handy either when you’re looking for a specific class, or if you don’t remember the exact name or location, but just want to look through all the places.</p><p>With “All Places” option enabled, this will work both for classes in your code, as those from SDK as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gPiHNyPFqw70i_T53GsyNw.png" /><figcaption>Open Search dialog and look for a class</figcaption></figure><p>To open this “Search” dialog, simply run:</p><p><strong>macOS</strong>: Cmd + O</p><p><strong>windows</strong>: Ctrl + N</p><p><em>Note: You can navigate with </em><em>Tab through “All”, “Classes”, “Files”, etc. tabs to look also in other places!</em></p><p>More info: <a href="https://www.jetbrains.com/help/idea/searching-everywhere.html?keymap=secondary_macos">IntelliJ IDEA — Searching everywhere</a></p><h3>#3 Find action</h3><p>This one runs in the same dialog as “Find a class by name”, but it’s so handy it requires a separate mention!</p><p>This shortcut is great when you want to use any of those actions, but… you haven’t remembered all those keyboard shortcuts yet. With one simple shortcut, you can access all of them!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LHkoVma3AFf2sXsIGVYBjg.png" /><figcaption>Find any action if you don’t remember the shortcut</figcaption></figure><p><strong>macOS</strong>: Cmd + Shift + A</p><p><strong>windows</strong>: Ctrl + Shift + A</p><p>More info: <a href="https://www.jetbrains.com/help/idea/searching-everywhere.html?keymap=secondary_macos#search_actions">IntelliJ IDEA — Search for actions</a></p><h3>#4 Reformat code</h3><p>With many languages, there comes a strict guideline of how each file should look like. It’s very important to keep the same code style across all the files in a project because it makes ours and other developers’ life easier when they have to read that in the future. To ensure the same code style you can run code reformatting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kPbrNA-jjHxfEUp-MhFlqA.jpeg" /><figcaption>Before reformatting (on the left) &amp; after (on the right)</figcaption></figure><p><strong>macOS</strong>: Cmd + Option + L</p><p><strong>windows</strong>: Ctrl + Alt + L</p><p>More info: <a href="https://www.jetbrains.com/help/idea/reformat-and-rearrange-code.html?keymap=secondary_macos">IntelliJ IDEA — Reformat and rearrange code</a></p><h3>#5 Rename</h3><p>The last, but not the least is a shortcut for renaming fields. IntelliJ IDEA has a very wide range of refactoring options, and that’s the one that I use probably 20 times a day. This refactoring option can be applied to everything — a class, method, field or variable name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GnZEd1SyFPJYl0nrPunk2w.png" /><figcaption>Rename any class, method, field or variable name</figcaption></figure><p><strong>macOS</strong>: Shift + F6</p><p><strong>windows</strong>: Shift + F6</p><p>More info: <a href="https://www.jetbrains.com/help/idea/rename-refactorings.html?keymap=secondary_macos">IntelliJ IDEA — Rename refactorings</a></p><p>That’s it for today! Thanks for reading, I hope you’ll try one or two of these shortcuts in your projects soon. Let me know in the comments if you use them already or if you know any other interesting ones! Stay tuned for more ✌️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f43e18eca833" width="1" height="1" alt=""><hr><p><a href="https://medium.com/code-well/top-5-most-used-keyboard-shortcuts-in-intellij-idea-f43e18eca833">Top 5 most useful keyboard shortcuts in IntelliJ IDEA</a> was originally published in <a href="https://medium.com/code-well">Code Well Mobile</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Labelling pictures in Flutter using Firebase Machine Learning]]></title>
            <link>https://medium.com/flutter-community/labelling-pictures-in-flutter-using-firebase-machine-learning-1869054afa62?source=rss-bfb18d52883e------2</link>
            <guid isPermaLink="false">https://medium.com/p/1869054afa62</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[mobile-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Paulina Szklarska]]></dc:creator>
            <pubDate>Mon, 18 Jan 2021 11:52:39 GMT</pubDate>
            <atom:updated>2021-01-18T23:59:28.315Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yk38FcyRQbmnXs9E" /><figcaption>Photo by <a href="https://unsplash.com/@agk42?utm_source=medium&amp;utm_medium=referral">Alex Knight</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Hi! In today’s article I would like to cover topic of image labelling using Firebase ML in Flutter.</p><p><a href="https://firebase.google.com/docs/ml">Firebase ML</a> is a library that uses machine learning for solving a variety of problems, including language identification, text recognition, face detection, or — main topic of this article — image labelling. With Firebase ML we can use great potential of machine learning without having expert knowledge on how neural networks work. In this article you’ll learn how to implement this API in your Flutter project.</p><p>Ready? Let’s start!</p><h3>Example</h3><p>In this article we’re gonna build a simple app that will allow us to choose photo from the gallery and label it with Firebase ML.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*oLLDJbvgZ4aixbsldHNq9A.png" /><figcaption>Flutter Image Labelling with Firebase ML</figcaption></figure><p>When working with Firebase ML, you can use either cloud or on-device API. In this article we will use on-device version. For more information about which version you should use, check out the <a href="https://firebase.google.com/docs/ml#cloud_vs_on-device">documentation</a>.</p><h3>Installing</h3><p>To setup Firebase ML in the Flutter app, we’re gonna use <a href="https://pub.dev/packages/firebase_ml_vision">firebase_ml_vision</a> library. First step is adding it to your pubspec.yaml file:</p><pre>dependencies:   <br>  firebase_ml_vision: ^0.10.0</pre><p><em>Note: At the time of writing this article, current version was 0.10.0. You may want to check current version on the </em><a href="https://pub.dev/packages/firebase_ml_vision"><em>firebase_ml_vision</em></a><em> website.</em></p><p>Next step is creating Firebase project and doing platform-specific configuration (for Android and iOS). To do that, you can follow steps from this tutorial: <a href="https://codelabs.developers.google.com/codelabs/flutter-firebase/#5">Codelabs — Firebase for Flutter</a>.</p><p>The last step is making setup for using on-device image labeler:</p><h4>Android</h4><p>To setup Android, add this piece of code to your build.gradle in android/app folder:</p><pre>android {<br>    dependencies {<br>        // ...<br><br>        api &#39;com.google.firebase:firebase-ml-vision-image-label-model:17.0.2&#39;<br>    }<br>}</pre><h4>iOS</h4><p>To setup iOS, add this line to your Podfile in ios folder:</p><pre>pod &#39;Firebase/MLVisionLabelModel&#39;</pre><p>And run cd ios &amp;&amp; pod update</p><h3>Usage</h3><p>To use image labels detection, we have to create FirebaseVisionImage object from an image file. For getting image file you can use many different libraries, for example <a href="https://pub.dev/packages/image_picker">image_picker</a>.</p><p><em>Note: To see the full code of Firebase ML with image_picker, visit </em><a href="https://github.com/pszklarska/flutter_image_labelling"><em>my GitHub repository</em></a><em>.</em></p><p>Once you get a file, you can use it to create FirebaseVisionImage object. I’ll do it in the separate method that will be later called by tapping on a button:</p><pre>Future&lt;void&gt; _getImageAndDetectLabels() async {<br>  final pickedFile = await picker<br>    .getImage(source:ImageSource.gallery);<br><br>  if (pickedFile != null) {<br>    File image = File(pickedFile.path);<br><br>    final FirebaseVisionImage visionImage =<br>      FirebaseVisionImage.fromFile(image);</pre><pre>    ...<br>  }<br>}</pre><p>With this object, we can call imageLabeler() to get a labeler and call processImage() to detect image labels:</p><pre>Future&lt;void&gt; _getImageAndDetectLabels() async {<br>  ...</pre><pre>  final ImageLabeler labeler =<br>      FirebaseVision.instance.imageLabeler();<br>  final List&lt;ImageLabel&gt; labels = await labeler<br>      .processImage(visionImage);<br>  }<br>}</pre><p>ImageLabel class contains information about labels — its name and confidence of the result:</p><pre><strong>for</strong> (ImageLabel label <strong>in</strong> labels) {<br>  <strong>final</strong> String name = label.text;<br>  <strong>final</strong> double confidence = label.confidence;<br>}</pre><p>And we can use that to show results on the screen:</p><pre>Text(<br>  labels<br>      .map((label) =&gt; &#39;${label.text} with confidence ${label.confidence.toStringAsFixed(2)}&#39;)<br>      .join(&#39;\n&#39;),<br>),</pre><p>Ta-da! That’s all. We learned how to use Firebase ML in Flutter to detect image labels.</p><p>To see the full source code of this example visit my GitHub repository:</p><p><a href="https://github.com/pszklarska/flutter_image_labelling">pszklarska/flutter_image_labelling</a></p><p>Thanks, that’s it for today! I hope you like this article. If you do, don’t forget to clap! ✌️</p><p>Follow Flutter Community on Twitter: <a href="https://www.twitter.com/FlutterComm">https://www.twitter.com/FlutterComm</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1869054afa62" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flutter-community/labelling-pictures-in-flutter-using-firebase-machine-learning-1869054afa62">Labelling pictures in Flutter using Firebase Machine Learning</a> was originally published in <a href="https://medium.com/flutter-community">Flutter Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to make an adaptable layout in Flutter?]]></title>
            <link>https://medium.com/flutter-community/how-to-make-an-adaptable-layout-in-flutter-4abe8376f426?source=rss-bfb18d52883e------2</link>
            <guid isPermaLink="false">https://medium.com/p/4abe8376f426</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Paulina Szklarska]]></dc:creator>
            <pubDate>Mon, 11 Jan 2021 10:23:22 GMT</pubDate>
            <atom:updated>2021-01-15T01:06:11.311Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi! Today I’d like to show you an example of how to make a layout that <strong>adapts to the different screen sizes</strong> in Flutter:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uUxydHTTU0Y6fYsfs6KZGA.gif" /><figcaption>Adaptable layout in Flutter</figcaption></figure><p>This layout, when the screen width is smaller than 500px, <strong>scales</strong> all the children and keeps their <strong>ratio</strong>. However, if the screen width is smaller than 500px, it <strong>keeps</strong> all children’s sizes and makes the whole view<strong> scrollable</strong>.</p><p>That kind of layout might be very useful when you want to <strong>keep a minimum width</strong> for all your children, allowing them to resize up if they have any space on the screen. It can have many practical uses, including support for different layouts in a mobile application based on screen size, or in the desktop and web apps.</p><p>If you want to<strong> see it in the action</strong>, check out <a href="https://dartpad.dev/28b1dbc82f451cbd53f65afb5dbf2d1c?">this DartPad example</a>! You can play with it, modify and keep it for later.</p><h3>Problem</h3><p>We’re gonna start with a simple layout. One Row with four children Containers, each of them wrapped in Expanded view to set different flex parameters. The code can look like this:</p><pre>class AdaptableRow extends StatelessWidget {</pre><pre>  @override<br>  Widget build(BuildContext context) {<br>    return Row(<br>      children: [<br>        Expanded(<br>          flex: 2,<br>          child: Container(color: Colors.yellow),<br>        ),<br>        SizedBox(width: 10.0),<br>        Expanded(<br>          flex: 1,<br>          child: Container(color: Colors.blue),<br>        ),<br>        SizedBox(width: 10.0),<br>        Expanded(<br>          flex: 3,<br>          child: Container(color: Colors.green),<br>        ),<br>        SizedBox(width: 10.0),<br>        Expanded(<br>          flex: 1,<br>          child: Container(color: Colors.pink),<br>        ),<br>      ],<br>    );<br>  }<br>}</pre><p>And will result in this simple UI:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nmpkv0_7-xVYsz0clEvJ6g.png" /></figure><p>How to make it react to the screen width? That’s super simple. We will use a combination of two widgets: SingleChildScrollView and ConstrainedBox. This first one will be responsible for making a view scrollable, and the second one for maintaining constraints for maximum width. Let’s start!</p><h3>Solution</h3><p>To make it work, all you have to do is to wrap your Row in those two widgets:</p><pre>import &#39;dart:math&#39;;</pre><pre>class AdaptableRow extends StatelessWidget {<br>  final minWidth = 500.0;<br>  <br>  @override<br>  Widget build(BuildContext context) {<br>    final screenWidth = MediaQuery.of(context).size.width;<br>    return SingleChildScrollView(<br>      scrollDirection: Axis.horizontal,<br>      child: ConstrainedBox(<br>        constraints: BoxConstraints(<br>          maxWidth: max(screenWidth, minWidth),<br>        ),<br>        child: Row(<br>          children: [<br>            Expanded(<br>              flex: 2,<br>              child: Container(color: Colors.yellow),<br>            ),<br>            SizedBox(width: 10.0),<br>            Expanded(<br>              flex: 1,<br>              child: Container(color: Colors.blue),<br>            ),<br>            SizedBox(width: 10.0),<br>            Expanded(<br>              flex: 3,<br>              child: Container(color: Colors.green),<br>            ),<br>            SizedBox(width: 10.0),<br>            Expanded(<br>              flex: 1,<br>              child: Container(color: Colors.pink),<br>            ),<br>          ],<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><h4>Explanation</h4><p>Thanks to ConstrainedBox, our view always has a maximum width of either screen width or 500px (whichever is bigger):</p><pre>maxWidth: max(screenWidth, minWidth),</pre><p>So, if the screen width is bigger than 500px (let’s say 800px), then it takes 800px as it’s maxWidth, allowing the view to take as much space as it’s needed.</p><p>However, if the screen size is less than 500px (let’s say 300px), ConstrainedBox imposes <strong>additional </strong>maxWidth constraint set to 500px, but SingleChildScrollView provides an infinite amount of space. This results in the view taking only as much space as it’s allowed by the constraints (500px) and being scrollable if it doesn’t fit on the screen.</p><p>If you want to know more about constraints in Flutter, you can read the article <a href="https://flutter.dev/docs/development/ui/layout/constraints">Understanding constraints</a> from a Flutter website.</p><p>That’s it for today! You can check out <a href="https://gist.github.com/pszklarska/28b1dbc82f451cbd53f65afb5dbf2d1c">the full source code on GitHub</a> or play with this <a href="https://dartpad.dev/28b1dbc82f451cbd53f65afb5dbf2d1c?">example on DartPad</a>. If you liked my post, don’t forget to clap! 🙌 🙌 🙌</p><p>Follow Flutter Community on Twitter: <a href="https://www.twitter.com/FlutterComm">https://www.twitter.com/FlutterComm</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4abe8376f426" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flutter-community/how-to-make-an-adaptable-layout-in-flutter-4abe8376f426">How to make an adaptable layout in Flutter?</a> was originally published in <a href="https://medium.com/flutter-community">Flutter Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Testing — My Tips & Good practices]]></title>
            <link>https://medium.com/flutter-community/flutter-testing-my-tips-good-practices-f7e88c311742?source=rss-bfb18d52883e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7e88c311742</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[tips]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Paulina Szklarska]]></dc:creator>
            <pubDate>Sat, 02 Jan 2021 00:11:49 GMT</pubDate>
            <atom:updated>2021-01-11T20:20:19.271Z</atom:updated>
            <content:encoded><![CDATA[<h3>Flutter Testing — My Tips &amp; Good practices</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*L5rd4TZ1U1gRTv20" /><figcaption>Photo by <a href="https://unsplash.com/@karishea?utm_source=medium&amp;utm_medium=referral">Kari Shea</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Hi! Today I’d like to share a few tips on how to write tests in Flutter. Some say that writing tests slows you down, but it is not true if you know how to write them efficiently. There are a few good practices on how to achieve that in basically every language and framework. In this article I will show you some of them in Flutter.</p><p>If you want to learn some basics about Flutter testing first, I encourage you to visit <a href="https://flutter.dev/docs/testing">Flutter website</a>. You can find there an explanation of unit, widget, and integrations tests. Otherwise, let’s start with today&#39;s tips!</p><h3>Follow Given-When-Then</h3><p>Are you familiar with <a href="https://martinfowler.com/bliki/GivenWhenThen.html">Given-When-Then</a> approach? It’s a style to formulate your tests. With that idea, you start a test by describing the initial state (e.g. <strong>Given</strong> user is logged in), then you describe what should happen (e.g. <strong>When</strong> user taps on a button), and finally you describe the expected state or result (e.g. <strong>Then</strong> user sees logged in message). This way lets you clearly separate the conditions, actions, and results and will help you see what’s the goal of each test.</p><p>Moreover, you can use that concept in the test name as well! This is how it may look like in Flutter:</p><pre>testWidgets(<br>    &#39;GIVEN user is logged in &#39;<br>    &#39;WHEN user taps on a button &#39;<br>    &#39;THEN info is shown&#39;, (tester) async {<br>  <br>  // given<br>  when(user.isLoggedIn).thenReturn(true);<br>  <br>  // when<br>  await tester.pumpWidget(Home());<br>  await tester.tap(find.byType(FlatButton));<br>  await tester.pump();<br>  <br>  // then<br>  expect(find.text(&#39;I\&#39;m logged in!&#39;), findsOneWidget);<br>});</pre><p>Note: If you don’t know what when(…).thenReturn(…) means, you can follow reading to learn about mockito. It’s a must-have for testing!</p><h3>Use Mockito</h3><p>If you don’t know <a href="https://pub.dev/packages/mockito">mockito</a> yet, it’ll become your best friend in testing. Mockito is a library that allows to mock behaviors of classes. Why you may need that? The simplest use case is, of course, anything time and resources consuming, such as API calls, database operations, loading resources from network, etc. Those services may take a while and you can’t always predict their result, so you really don’t want them in your tests. <em>Imagine running a test that randomly fails because you have a bad internet connection!</em></p><p>This is where mockito gets very useful. You can use it to mock behaviour of any(!) class you want and return the expected behaviour. For example:</p><pre>when(apiClient.fetchKittyNames()).thenReturn([&#39;Lilly&#39;, &#39;Bella&#39;,&#39;Coco&#39;]);</pre><pre>when(databaseManager.saveProduct()).thenReturn(true);</pre><pre>when(resourceProvider.getImage()).thenThrow(Exception());</pre><p>This way you can check all possibilities in your tests with a full control over external dependencies. Pretty cool, right?</p><p>However, it’s not only for long-running operations. You can use Mockito for all your dependencies. Let’s look at the previous example with the user being logged in. If we want to test different behaviours based on the user state, we have to pass User mock to Home widget:</p><pre>testWidgets(<br>    &#39;GIVEN user is logged in &#39;<br>    &#39;WHEN user taps on a button &#39;<br>    &#39;THEN info is shown&#39;, (tester) async {<br>  <br>  // given<br>  final user = UserMock();<br>  ...  </pre><pre>  // when<br>  await tester.pumpWidget(MaterialApp(home: Home(user: user)));<br>  ...<br>});</pre><p>Where UserMock is a new class created outside of the test with a mockito:</p><pre>class UserMock extends Mock implements User {}</pre><p>And this way we can control whether the user is logged in or not and check that in our test:</p><pre>testWidgets(<br>    &#39;GIVEN user is logged in &#39;<br>    &#39;WHEN user taps on a button &#39;<br>    &#39;THEN info is shown&#39;, (tester) async {<br>  <br>  // given<br>  final user = UserMock();<br>  when(user.isLoggedIn).thenReturn(true);<br>  <br>  // when<br>  await tester.pumpWidget(MaterialApp(home: Home(user: user)));<br>  await tester.tap(find.byType(FlatButton));<br>  await tester.pump();<br>  <br>  // then<br>  expect(find.text(&#39;I\&#39;m logged in!&#39;), findsOneWidget);<br>});</pre><p>You can check <a href="https://gist.github.com/pszklarska/4b5140cd485d78e1d9c8002f4ac84b26">the full source code</a> on my GitHub:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d85a02244f9202a4a08109dbe1e6d812/href">https://medium.com/media/d85a02244f9202a4a08109dbe1e6d812/href</a></iframe><p>That’s it for today! I hope this post clarified Flutter testing topic for you. If you still need more information, I encourage you to dive deeper into <a href="https://flutter.dev/docs/testing">Flutter documentation</a> where you can find a lot of useful articles and tutorials. Thanks for reading! 👋</p><p><a href="https://www.twitter.com/FlutterComm">https://www.twitter.com/FlutterComm</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7e88c311742" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flutter-community/flutter-testing-my-tips-good-practices-f7e88c311742">Flutter Testing — My Tips &amp; Good practices</a> was originally published in <a href="https://medium.com/flutter-community">Flutter Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to start writing unit tests?]]></title>
            <link>https://pszklarska.medium.com/how-to-start-writing-unit-tests-287f72331c4b?source=rss-bfb18d52883e------2</link>
            <guid isPermaLink="false">https://medium.com/p/287f72331c4b</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[unit-testing]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Paulina Szklarska]]></dc:creator>
            <pubDate>Wed, 16 Sep 2020 11:22:38 GMT</pubDate>
            <atom:updated>2020-09-16T23:35:23.609Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*z_K47EBGa-9A3T8e" /><figcaption>Photo by <a href="https://unsplash.com/@andrewtneel?utm_source=medium&amp;utm_medium=referral">Andrew Neel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Often you read those articles about unit testing or TDD, you see examples of fully tested code and maybe you wonder — it looks so simple, why haven’t I started doing this yet?</p><p>Perhaps, as it was in my case, you come with this knowledge to your project, and… you have no idea where to even start it. It’s easy to try testing on a small, example project that someone showed you to prove that you don’t have to feel scared about it. But it’s different when it comes to practice. But hey, there’s good news! If you already made this first step and feel convinced that you’d like to add some tests to your code, you still can do it. You just need more than a simple article showing you how can you write tests. You need a proper framework. You need a schema that you can follow every time you’d like to test something, so you can take it and start testing in your project.</p><p>Let’s make an exercise here. Go to your project (can be any you have in mind, but it’s the best when you’re familiar with the whole structure of the code) and grab some class you’d like to test. Before doing that you may ask yourself a question…</p><h4>Which class should I test?</h4><p>That’s the first decision we need to make. When it comes to testing, you have a few options. It can be a class that has some complicated logic that you’d like to cover with tests to make sure nothing will blow in your face when you don’t expect. It can be some UI class that you’d like to check if it’s gonna look ok in different scenarios. Or it can be class with utilities that you keep to make writing code simpler. Can be anything. If you don’t know what you should use, just take the main screen of your app. You can change this decision later.</p><blockquote>Pro tip — it doesn’t really matter at the beginning, so don’t feel super focused on it. As you’ll be more natural with your testing, you’ll feel which classes are better candidates for testing, and which are not, but at the beginning probably most of your classes should be tested (if you don’t have any tests in your project).</blockquote><p>In my case, I picked up a class to show the list of articles in a feed.</p><p>Now, as we already have chosen a class that we’ve committed to cover with tests, it’s time to ask ourselves:</p><h4>What do I want to test here?</h4><p>Now, look into your class. What’s the main purpose? If you can answer it shortly, that’s good, it means your class is probably quite small and responsible for a specific thing. If you can’t say, what’s this class exactly for (e.g. it’s mostly for showing a list of products, but it’s also for making some dates modifications), then it probably means that your class is too big or has too many different responsibilities. Why is it important? Because at this step you need to decide what do you want to test and it’s best if you’ll focus on just one thing, as that’s what unit testing is all about. If your class is too big, just try to extract non-main responsibilities to the other classes. You can unit test them separately.</p><p>When you already know, what’s the purpose of your class, you can come up with some testing scenarios. For example, if you have a class to prepare your account history based on a transaction list, you can think about different cases, e.g. how the history should look like when this list is empty? What if there are transactions from different months? What if some transactions have positive, and the others have negative values? What if the dates have different formats?</p><p>When you think about test cases you should always have at least:</p><ul><li>happy path scenario (that’s what you think should be a normal case)</li><li>edge cases (null, empty, zero, negative values)</li><li>unhappy path (that’s what you think shouldn’t be valid and your test can confirm that)</li></ul><p>Of course, you can have much more than this. There are tons of books about preparing unit test cases, but that’s just for a good start.</p><p>For my class, the main responsibility is to properly show a different kind of articles. I have few different types there (e.g. with title, body, image, video), they are all optional and can be in different configurations. I’d like to test that for each scenario the article renders correctly.</p><p>Now, as we have it, it’s time to think…</p><h4>How can I test it?</h4><p>You already know what you’d like to test, you open your class (yeah, do it now!) and you wonder… what’s next?</p><p>Here’s what we already have: a subject of the test (your class) and different testing scenarios. Let’s start with the simplest one, a happy path.</p><p>There’s a template to describe user stories called Given-When-Then. It means that <em>Given</em> some conditions, <em>When</em> something happens, <em>Then</em> some result occurs. You can follow that template in your test. Start with <strong>Then</strong> part first. What’s the result you expect? For me, I expect to see an article with a title and video. It should be visible <strong>When </strong>I enter article details, assuming that <strong>Given </strong>article has title and video. It may sound really silly, of course, when an article has a video, I want to see a video. But nothing is silly in unit testing. There might be really complicated things happening under the hood, but you have simple action and you expect a simple result. Now, look at your code — what’s your Given-When-Then?</p><p>When you picked up your scenario, again start from the end — write assertions first. Why? Because <strong>it’s much simpler to make puzzles when you see an image on the box.</strong></p><p>Your first assertions (depending on the language) can be as simple as assertThat(yourClass.someMethod()).isEqualTo(result)</p><p>Now, look at your code. Remember what’s your test subject and try to eliminate all the other dependencies. If you test countdown calculation, don’t worry about the current date — mock it! If you want to check if the user list is shown properly, don’t use real data from API — mock it! If you test login flow, but you use some external library for it — mock it!</p><p>That might not be that easy at the beginning. When you write code without tests in mind, you don’t always focus on separating different logics. It might occur to you that you have everything in one class and when you want to test it, you can’t — because it’s all coupled together. Unfortunately, that’s the moment when you need to take a big shovel and start refactoring. It doesn’t have to be a huge refactor, you can just extract classes one by one, piece by piece. But to be able to write unit tests, you’ll need to.</p><p>At this point, you’ll probably realize two things:</p><ol><li>It’s good to create smaller classes with dependencies because you can separate some portions of logic and you can test it independently</li><li>If you test any kind of frontend app (either web or mobile), it’s good to keep your UI and business logic separately. If you have it in one place, it’s often impossible to write a proper unit test</li></ol><p>If you don’t know what you should put as someMethod() , because your case is too complicated to be described as just one method, it’s ok to have multiple assertions. If you want to test that filling the form with a valid data triggers progress indicator, and then enables button and makes automatic navigation to the next screen, then… it’s ok, as long as you’re testing one specific scenario.</p><p>Depending on your case, you might want to call some actions before and that’ll be your <em>When</em>. The last step is usually arranging context around the test and preparing the environment, e.g. opening the proper screen, creating model data, which is your <em>Given.</em></p><p>Now… Run your test! And don’t worry if it’s not green immediately. It takes time and practice, but it’s worth it. After you’ll see this green light for the first time… You’ll know why!</p><p>That’s it! You wrote your first test in your project. And remember, it doesn’t have to be perfect at the beginning. You can test very easy things, or tests may not have that much sense. But as you’ll write them more, you’ll feel more confident about it, and one day you’ll ask yourself… What was I afraid of? And you won’t even remember.</p><p>Thanks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=287f72331c4b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to turn your phone into a beacon with Flutter?]]></title>
            <link>https://medium.com/flutter-community/how-to-turn-your-phone-into-a-beacon-with-flutter-47619bfa9963?source=rss-bfb18d52883e------2</link>
            <guid isPermaLink="false">https://medium.com/p/47619bfa9963</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[beacons]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Paulina Szklarska]]></dc:creator>
            <pubDate>Tue, 28 May 2019 23:17:33 GMT</pubDate>
            <atom:updated>2019-07-25T13:50:41.864Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi! 👋</p><p>Today I’d like to introduce you into a <strong>beacons</strong> and how to <strong>became a beacon </strong>using only your <strong>phone</strong> and a <strong>Flutter</strong>. Let’s start!</p><h4>What’s a beacon?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*SgA52eSVPVkCbYuBeEKgzA.png" /><figcaption>Beacon. Source: <a href="https://community.estimote.com/">https://community.estimote.com</a></figcaption></figure><p>Beacon is a small device, operating on batteries that can last for a few years. It can send a radio signal and communicate with smartphones via Bluetooth. The name is not without a reason — when we go near the beacon, it can contact the application on our phone and display the information we need, refer us to the store or informs us about the current place.</p><blockquote>For instance, if you walk into the museum (with your Bluetooth on), you can get the informations about the artpiece whenever you pass it by!</blockquote><p>The possibilites are endless. Airports, shops, museums, bus stops, shopping centers, music festivals, galleries, smart homes. The list of examples is huge.</p><h4>But why use your phone instead of a beacon?</h4><p>Beacon is a great device. It’s small, so you can hang it almost enywhere. It looks nice on the walls, next to the cash desk or… even on the trees.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Iu5TLLuZwAlH8CQ8ttXEEg.jpeg" /><figcaption>Beacon on the tree. Source: <a href="https://www.flickr.com/photos/jnxyz/13570805343/">Jona Nalder</a></figcaption></figure><p>But beacon is… another device. You need to buy it and remember about changing to the new one when batteries are out (it needs to be done every 1-2 years, but still). What about using the device you already have, your phone? The answer is good — you can!</p><h4>How to turn your phone into a beacon?</h4><p>I faced this issue some time ago. There are ready-made solutions for both platforms, e.g. <a href="https://altbeacon.github.io/android-beacon-library/">AltBeacon</a> library for Android or <a href="https://developer.apple.com/documentation/corelocation">CoreLocation</a> for iOS. But there was nothing for Flutter. So I decided to… write it on my own!</p><p><a href="https://pub.dev/packages/beacon_broadcast">beacon_broadcast | Flutter Package</a></p><p>I made a plugin that makes all the work for you. All you need to do to turn your phone into beacon is to add a plugin to your Flutter project:</p><pre>dependencies:<br>  beacon_broadcast: <strong>^0.2.1</strong></pre><p>And then after running <strong><em>flutter pub get </em></strong>command you’re ready to go:</p><pre>import &#39;package:beacon_broadcast/beacon_broadcast.dart&#39;;</pre><pre>BeaconBroadcast()<br>    .setUUID(&#39;39ED98FF-2900-441A-802F-9C398FC199D2&#39;)<br>    .setMajorId(1)<br>    .setMinorId(100)<br>    .start();</pre><p>To check more options (e.g. setting beacon layout, manufacturer, transmission power), visit <a href="https://pub.dev/packages/beacon_broadcast">the plugin site</a>.</p><p>That’s all! I hope you’ll find this post (and my library!) useful. If you have any comments or feedback, don’t hesitate to left it.</p><p><a href="https://twitter.com/FlutterComm">JavaScript is not available.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47619bfa9963" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flutter-community/how-to-turn-your-phone-into-a-beacon-with-flutter-47619bfa9963">How to turn your phone into a beacon with Flutter?</a> was originally published in <a href="https://medium.com/flutter-community">Flutter Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What’s new in Flutter at IO ‘19?]]></title>
            <link>https://medium.com/flutter-community/whats-new-in-flutter-at-io-19-bb7b03d98c0f?source=rss-bfb18d52883e------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb7b03d98c0f</guid>
            <category><![CDATA[google]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[mobile]]></category>
            <dc:creator><![CDATA[Paulina Szklarska]]></dc:creator>
            <pubDate>Sat, 11 May 2019 14:05:26 GMT</pubDate>
            <atom:updated>2019-05-12T08:44:32.085Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*Ns_Yx3UgctlJESbkpMDz0g.png" /></figure><p>This year’s <a href="https://events.google.com/io/">Google IO</a> is behind us. Google introduces us to a lot of new things. Among all of the informations, there is some great news for Flutter. What’s this? Let’s check!</p><h4>Flutter for Web</h4><p>The biggest news for Flutter developers is Flutter Web announcement. Back in December on <a href="https://developers.google.com/events/flutter-live/">Flutter Live</a>, we’ve heard about the plans for incoming 2019 year. One of those plans was to support building websites with Flutter. Now, this week, Google has released a <strong>preview version of Flutter for the web! </strong>By the way, it’s not called <em>Hummingbird</em> anymore, now it’s called <em>Flutter web.</em></p><p>Flutter Web supports popular browsers — Chrome, Firefox, and Safari. For now, there’s <strong>no support for plugins system yet</strong>, so you can’t port your application without mocking part of it, but Flutter team is constantly making changes and improvements, so it’ll be possible any day soon. And I encourage you to <strong>give it a try</strong>, you can build beautiful UI for web exactly as you’ll build it for mobile app:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tt7TtKpggWn2O536FZ0nDQ.png" /><figcaption>Flutter for web demo running on Chrome, Firefox, and Safari. Source: <a href="https://medium.com/flutter-io/bringing-flutter-to-the-web-904de05f0df0">https://medium.com/flutter-io/bringing-flutter-to-the-web-904de05f0df0</a></figcaption></figure><p>You can read more about Flutter for web <a href="https://medium.com/flutter-io/bringing-flutter-to-the-web-904de05f0df0">on the new website</a>.</p><h4>Flutter 1.5</h4><p>Another huge announcement is a new version of Flutter: 1.5! With this new version came a lot of improvements, including <a href="https://pub.dev/packages/in_app_purchase">In-App purchase plugin</a> (this <a href="https://github.com/flutter/flutter/issues/9591">issue</a> had over a hundred reactions!), support for iOS widgets translations and updates for new <a href="https://developer.apple.com/news/?id=03202019a">App Store requirements</a>.</p><p>Also, worth noticing is support for Dart 2.3 with UI-as-code feature, which allows us to build UI with code in a more efficient way. For example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/1*hxC4-GFRb46ibEn9ss3DsQ.png" /></figure><p>You can more about Flutter 1.5 <a href="https://medium.com/flutter-io/announcing-flutter-1-5-d203c6072e5c">here</a>.</p><h4>Flutter ML Kit</h4><p>Another great announcement is the new project — <a href="https://github.com/firebase/mlkit-custom-image-classifier">ML Kit Custom Image Classifier</a>. It’s an app (made of course in Flutter!) for creating custom image classification models. In this app, you can <strong>create your own dataset for machine learning</strong>. The app is made using Firebase and allows you to do the whole process — from creating your database, through updating it with the new data (you can invite friends to help you!), ending with training and testing your models on your device.</p><h4>Flutter for desktop</h4><p>Although Flutter for desktop is not something production-ready, the Flutter team published an early version of <a href="https://github.com/flutter/flutter/wiki/Desktop-shells">instructions for creating Flutter apps for desktops</a>. It may be a great point to start playing with Flutter desktop and we’re keeping our fingers crossed for this to be ready soon.</p><h4>Summary</h4><p>Google IO has brought us a lot of news. As far as we can see, Flutter team puts a lot of effort into making Flutter beyond mobile by creating the ability to develop apps to the web and desktop.</p><p>By studying <a href="https://github.com/flutter/flutter/wiki/Roadmap">Flutter 2019 roadmap</a> I can say it’ll be a very interesting year for the Flutter. I’m really excited about being part of it 🙌</p><p>You can read the whole announcement <a href="https://developers.googleblog.com/2019/05/Flutter-io19.html">on GoogleDevelopers blog</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb7b03d98c0f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flutter-community/whats-new-in-flutter-at-io-19-bb7b03d98c0f">What’s new in Flutter at IO ‘19?</a> was originally published in <a href="https://medium.com/flutter-community">Flutter Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create button animation with Flare in Flutter? Part3: Implement animation in Flutter project]]></title>
            <link>https://medium.com/flutter-community/how-to-create-button-animation-with-flare-in-flutter-part3-implement-animation-in-flutter-project-f335f88311c8?source=rss-bfb18d52883e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f335f88311c8</guid>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[animation]]></category>
            <dc:creator><![CDATA[Paulina Szklarska]]></dc:creator>
            <pubDate>Tue, 07 May 2019 12:01:00 GMT</pubDate>
            <atom:updated>2019-05-07T12:01:00.927Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ts7KAjP9Qk8GAy-xwnCPsg.png" /></figure><h3>How to create button animation with Flare in Flutter? Part 3: <strong>Implement animation in Flutter project</strong></h3><p>Hi everyone! 👋</p><p>In today’s article we’ll continue a series in which we’re going through the process of creating animation in Flutter using <a href="https://www.2dimensions.com/about-flare">Flare</a>. This series is split into three parts and you can check all of them here:</p><ul><li><a href="https://medium.com/flutter-community/how-to-create-button-animation-with-flare-in-flutter-part-1-create-your-first-animation-b1c61c81bc1c"><strong>Part 1: Create your first animation!</strong></a></li><li><a href="https://medium.com/flutter-community/how-to-create-button-animation-with-flare-in-flutter-part-2-animations-with-trimpath-43c8a4e6940f"><strong>Part 2: Animations with TrimPath</strong></a></li><li><strong>Part 3: Implement animation in Flutter project</strong></li></ul><p>This is the last part. In this article we’ll go through the final step: <strong>integrating animation with our Flutter project</strong> to achieve this result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*kOZbmchzlgARjtTYBzEuUA.gif" /></figure><p>If you haven’t read previous articles, you can <strong>read them all</strong> (I encourage you!) or you can <strong>fork </strong><a href="https://www.2dimensions.com/a/pszklarska/files/flare/super-cool-button-part2/preview"><strong>this Flare project</strong></a> and start from this point.</p><h4><strong>Step 1: Create a Flutter project</strong></h4><p>We’ll start with the empty Flutter project. You can omit this step if you’ll integrate animation into an existing app. If you don’t have one, follow these steps from <a href="https://flutter.dev/docs/get-started/test-drive#create-app">the guide on Flutter site</a>.</p><h4>Step 2: Add flare_flutter package</h4><p>To have the ability to use flare in your Flutter project, you need to add proper library. This library is called<strong> flare_flutter</strong> and you can check it on the <a href="https://pub.dev/packages/flare_flutter">pub packages site</a>. Here you’ll find also instructions on how to install and use it. Basically, all you need to do is:</p><p>a) Add this to your pubspec.yaml file:</p><pre>dependencies:   <br>  <strong>flare_flutter: ^1.5.0</strong></pre><p>b) Run flutter packages get to update packages in your project.</p><p>Now you’re ready to use it!</p><p><strong>Step 3: Add animation code</strong></p><p>When we have a library ready, we can run with the actual part of this article: <strong>coding</strong>. We’ll start by modifying main.dart file:</p><pre><strong>import </strong>&#39;package:flare_flutter/flare_actor.dart&#39;;<br><strong>import </strong>&#39;package:flutter/material.dart&#39;;<br><br><strong>void </strong>main() =&gt; runApp(FlareButtonApp());<br><br>class FlareButtonApp extends StatefulWidget {<br>  @override<br>  _FlareButtonAppState createState() =&gt; _FlareButtonAppState();<br>}<br><br>class _FlareButtonAppState extends State&lt;FlareButtonApp&gt; {<br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      home: Scaffold(<br>        body: Center(<br>          child: SizedBox(<br>            width: 500,<br>            height: 75,<br>            child: <strong>FlareActor(<br>              &#39;assets/Button.flr&#39;,<br>              animation: &#39;Loading&#39;,<br>              fit: BoxFit.fitWidth,<br>            )</strong>,<br>          ),<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><p>The most interesting widget here is <strong>FlareActor </strong>. This widget is reponsible for showing animation. As you can notice, I wrapped this widget inside SizedBox widget — I’ve done it to make sure that my widget’s size will be exactly 500x75 pixels.</p><p>FlareActor has few parameters. First one, ‘assets/Button.flr’, is the file path to our animation. To make it work, we need to export our Flare file and put this file into assets:</p><h4>Step 3.1: Add Flare asset</h4><p>To add Flare asset, you need to open your Flare file (like <a href="https://www.2dimensions.com/a/pszklarska/files/flare/super-cool-button-part3">this one</a>), tap on the Export icon on the right, choose Export and confirm it. The generated file will have <em>*.flr</em> extension and you need to put it inside some folder in Flutter project. In my case it’s <em>assets</em> in the project root:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/372/1*9INJAnWlCsJFxfkz66-C5w.png" /></figure><p>To make this file visible for Flutter, you need to declare assets folder in pubspec.yaml file:</p><pre><strong>flutter</strong>:<br>  <strong>assets</strong>:<br>    - assets/</pre><p>And that’s all! Now let’s go back to FlareActor widget.</p><p><strong>Step 3: Add animation code (continuation)</strong></p><p>The next parameter in FlareActor widget is animation: ‘Loading’ . That’s the name of our animation. You can change the name of the animation in Flare project, from the menu on the left visible after switching to <em>Animate</em> tab:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*nZUCO5tUhHbsJeE50_eI5g.png" /></figure><p>Next parameter is fit: BoxFit.fitWidth<strong>, </strong>which describes the way animation is shown (just as with images), in this case, we’d like to make sure the full width is visible.</p><p>That’s it! You can run your app and check the animation! Right now it should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*PjXa2ADCjtVe7JfAiBIsoQ.gif" /></figure><p>But there is more…</p><h4>Bonus: Adding idle and restart animations</h4><p>If you saw the animation from the beginning of the article, you may notice that it was slightly different. This is because we can add <strong>multiple animations</strong> in Flare project to have<strong> multiple states</strong> of our Flare objects. And right now we only have one state (<em>Loading</em>).</p><p>I added the missing states to the file <a href="https://www.2dimensions.com/a/pszklarska/files/flare/super-cool-button-part3/preview">here</a>. You can notice there are two more animations: <em>Idle</em> and <em>Restart. </em>The first one is not really an animation, rather an <strong>initial state</strong> of the button. The second one is the <strong>animation that happens after we click</strong> on the button.</p><p>To make them work you need to add few lines in the code I presented above:</p><pre>class _FlareButtonAppState extends State&lt;FlareButtonApp&gt; {<br>  <strong>String _animationName = &#39;Idle&#39;;</strong><br><br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      home: Scaffold(<br>        body: Center(<br>          child: SizedBox(<br>            width: 500,<br>            height: 75,<br>            <strong>child: GestureDetector(<br>              onTap: _onButtonTap,</strong><br>              child: FlareActor(<br>                &#39;assets/Button.flr&#39;,<br>                animation: _animationName,<br>                fit: BoxFit.fitWidth,<br>              ),<br>            ),<br>          ),<br>        ),<br>      ),<br>    );<br>  }<br><br>  <strong>void _onButtonTap() {<br>    setState(() {<br>      if (_animationName == &#39;Idle&#39; || _animationName == &#39;Restart&#39;) {<br>        _animationName = &#39;Loading&#39;;<br>      } else {<br>        _animationName = &#39;Restart&#39;;<br>      }<br>    });<br>  }</strong><br>}</pre><p>Voilà! Now our animation works like a charm:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*aWtqmm5peWzGQURp0JbfKA.gif" /></figure><p>You can check this Flare project <a href="https://www.2dimensions.com/a/pszklarska/files/flare/super-cool-button-part3">here on 2dimensions.com</a>.</p><p>You can check also code for the repository from today’s article here:</p><p><a href="https://github.com/pszklarska/flutter_flare_button">pszklarska/flutter_flare_button</a></p><h4>Summary</h4><p>That’s all! It’s the end of this series. Through all the articles we completed the <strong>full process of creating fancy animation</strong> using Flare and integrating this animation into Flutter project. If you’d like to check previous posts, you can do it here:</p><ul><li><a href="https://medium.com/flutter-community/how-to-create-button-animation-with-flare-in-flutter-part-1-create-your-first-animation-b1c61c81bc1c"><strong>Part 1: Create your first animation!</strong></a></li><li><a href="https://medium.com/flutter-community/how-to-create-button-animation-with-flare-in-flutter-part-2-animations-with-trimpath-43c8a4e6940f"><strong>Part 2: Animations with TrimPath</strong></a></li><li><strong>Part 3: Implement animation in Flutter project</strong></li></ul><p>Thanks for reading, comments, and feedback! 🙌 If you liked this article, don’t hesitate to clap it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f335f88311c8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flutter-community/how-to-create-button-animation-with-flare-in-flutter-part3-implement-animation-in-flutter-project-f335f88311c8">How to create button animation with Flare in Flutter? Part3: Implement animation in Flutter project</a> was originally published in <a href="https://medium.com/flutter-community">Flutter Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>