<?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 Quang Ngo Duc on Medium]]></title>
        <description><![CDATA[Stories by Quang Ngo Duc on Medium]]></description>
        <link>https://medium.com/@ferguquang?source=rss-ef69529a93fc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*GZ62Cg6BEeZd3X7P</url>
            <title>Stories by Quang Ngo Duc on Medium</title>
            <link>https://medium.com/@ferguquang?source=rss-ef69529a93fc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 30 May 2026 17:39:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ferguquang/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[Flutter vs. React Native: Which is the right cross-platform framework for you?]]></title>
            <link>https://medium.com/@ferguquang/flutter-vs-react-native-which-is-the-right-cross-platform-framework-for-you-d3e2eb3524a3?source=rss-ef69529a93fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3e2eb3524a3</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Quang Ngo Duc]]></dc:creator>
            <pubDate>Mon, 12 Dec 2022 07:08:32 GMT</pubDate>
            <atom:updated>2022-12-12T07:08:32.274Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XnEU95SWMcYl5MV8mNOtzA.png" /></figure><p>Building traditional native apps often requires maintaining two or more codebases. Let’s look at two frameworks that let you keep your code unified.</p><p>I recently worked on an app prototype with a friend in another industry. By day, I’m a full-stack developer targeting desktop and mobile web, but considering the use cases for this app, we determined it needs to be fully-functional offline. There are a couple of traditional ways for web developers to deliver offline experiences:</p><ol><li><strong>Progressive Web Apps</strong>. With the addition of a manifest file and service worker, a responsive web app can be quickly converted to something that will load without an internet connection. Whether it will actually work is another story and really depends on how the web app was built. Typically, there’s a lot more to be done surrounding data caching, syncing, conflict resolution, and offline request handling than there is in simply <a href="https://blog.heroku.com/how-to-make-progressive-web-app">making your app a PWA</a>, and at the end of the day you still won’t have an app in either app store. For it to show up on someone’s home screen, the user will have to visit the website and click the <strong>Install </strong>button at the bottom of the screen, which is an unfamiliar operation and goes against most users’ muscle memory of swiping away or clicking X on anything that covers site content. I have high hopes for the future of PWAs, but right now I don’t see them as an effective way of reaching users.</li><li><strong>Cordova</strong>. <a href="https://cordova.apache.org/">Apache Cordova</a> turns websites into mobile apps by putting them in a WebView (basically an iframe for native apps) and packaging that WebView as an iOS or Android app. While this is by far the cheapest way to bring a website to both app stores, and in theory can accomplish nearly everything a native app can, in my experience this is anything but frictionless. Both the process and the end result are full of unpleasant surprises. Even a website that works perfectly in a mobile browser may need substantial work to look and feel right as a Cordova app. Additionally, the support for native smartphone APIs is patchy and sometimes unreliable; even simple things like media controls can be frustrating to implement. So although Cordova fills an important role as the most cost-efficient way to deliver a “website in an app,” I decided it wasn’t a great choice for a new project. (I would be remiss here not to mention <a href="https://ionicframework.com/">Ionic</a>, which really helps achieve a native look and feel but typically requires a partial or full rewrite and still doesn’t fix a lot of the problems I’ve mentioned.)</li></ol><p>Having ruled out those options, the remaining ones I was aware of were:</p><ul><li>Traditional native apps</li><li>Xamarin</li><li>React Native</li><li>Flutter</li></ul><p>Building traditional native apps would require me to maintain two or more codebases, and I’d be learning Swift from scratch, so that sounded like more trouble than I signed up for. Xamarin might have been a good choice since I use .NET at my day job, but my impression is that it doesn’t have the robust community or market share that the others have. I also have some relevant experience to consider: I’ve built a couple of side projects with React and have been working on a game in Flutter. In the end, React Native and Flutter seemed like the best choices for my skillset.</p><p>Over the course of a couple weekends, I built two proof of concept apps, one each with the latest versions of React Native and Flutter. I didn’t go into this planning to write about my experiences — I just wanted to prototype a simple app — but the comparison has turned out to be very interesting; these are two radically different frameworks, each frustrating and delightful in its own ways, and I think it’s valuable to compare and contrast them from a web developer’s perspective.</p><p>I don’t expect to come across totally unbiased. My experience with Flutter has been much better than with React Native. However, I’ll try my best to treat them fairly and acknowledge the advantages and disadvantages of each.</p><h3>How they work: Components and rendering</h3><p>React Native (created by Meta/Facebook) provides a set of React components that represent layout and UI abstractions such as a View (used for containing and arranging elements, like a `div` with `display: flex` on it) or a TextInput (like an HTML `input` or `textarea`). Then it uses a C++ engine, compiled separately for each platform, to translate those into native components for rendering on screen. Your code is run with a JavaScript engine (currently JavaScriptCore, the engine used by Safari, but a custom engine called Hermes is probably going to take over soon) and communicates with native code via serialized messages over a bridge.</p><p>Flutter (created by Google) is a view framework, rendering engine, code execution engine, and component library all in one. It uses Dart, a high-level programming language created and maintained by Google, and is clearly inspired by React: each widget (component) has a build (render) method that typically returns a tree of one or more other widgets. Flutter does not render native components on the target device, instead opting to take over the entire screen and render its own UI (not unlike a video game). Your Dart code is compiled ahead of time for the various instruction sets used by desktop and mobile devices. On the web, it’s transpiled to JavaScript.</p><h3>The learning process: Language and tools</h3><p>You might think the time needed to learn a new programming language for Flutter would be an order of magnitude greater than the time it takes to set up and learn the tools of React Native. However, I didn’t find this to be true at all. Dart is a very simple and developer-friendly language with strong similarities to TypeScript, C#, and Kotlin. Its documentation is superb. What’s more, I enjoyed learning it — it’s extremely readable and has a lot of cool features like <a href="https://dart.dev/guides/language/language-tour#cascade-notation">cascade notation</a> and <a href="https://dart.dev/null-safety">null safety by default</a>, and the compiler is good at telling you what’s wrong. So yes, it’ll take a day or so to learn the language, but if you already know a strongly-typed imperative programming language, you’ll have an easy time of it.</p><p>With React Native, you won’t spend any time learning a new programming language as long as you know JavaScript or TypeScript. You will, however, have to learn some standard tools and libraries to get up to speed — and it feels like the tooling and ecosystem for React Native are far more complex than for Flutter, with no real advantage in quality (more on this in the next section). For me, the ramp-up time for both frameworks was about the same, comparing when I first learned Flutter (via Flame, a game development library) to when I learned React Native. I’d estimate minimum time to productivity at ten to fifteen hours either way.</p><p>I acknowledge that my case isn’t necessarily typical. There are more developers on the market who are conversant in React than in any form of Dart, so there are a lot of business scenarios where React Native may make more sense. But for your own projects, don’t let the Dart barrier hold you back.</p><h3>Features: There ain’t no party like a first party</h3><p>React Native follows the standard approach to web development characterized by your local `node_modules` folder. It includes the basic tools you need to have an app, but if you want a UI language (like <a href="https://material.io/design">Material Design</a> or <a href="https://developer.apple.com/design/">Cupertino</a>), icons, state management, localization, HTTP requests, advanced developer tools, and so forth, you’ll be relying on community-supported code or writing your own. This isn’t necessarily a bad thing. The React Native community is large and very active. But it does mean that a typical React Native app is going to be a patchwork quilt of packages representing different design philosophies, non-standardized APIs, and hit-or-miss documentation.</p><p>By comparison, Google has invested heavily in Flutter over the last several years and supports an impressive feature set out of the box: Material Design and Cupertino components, hundreds of icons, a basic state management setup, several runtime developer tools, and 25 core first-party packages including localization, HTTP requests, and more — all with <a href="https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking">tree-shaking</a> so you don’t bloat your app with anything you’re not using. The components I’ve used all have a consistent design and fit the framework like a glove. You could ship a powerful and well-designed Flutter app without any third-party packages at all, which just isn’t feasible with React Native. The difference in size between my `package.json` file in React Native and my `pubspec.yaml` file in Flutter is staggering. Flutter just does more.</p><p>Or, I should say, it does more off the shelf. Dart’s package repository, <a href="https://pub.dev/">pub.dev</a>, will probably never approach the size of NPM. It’s hard to estimate how many NPM packages are compatible with React Native considering that it doesn’t have access to browser or Node APIs, but I’d guess there are still more than enough to win the quantity battle.</p><p>If you’re confident in your ability to write uncommon algorithms or visuals on your own, you’ll probably be fine with either framework. Otherwise, you’ll want to snoop around in each package repository before you start and see if they have what you need.</p><h3>The UI: Platforms, consistency, and customization</h3><p>I had some trouble getting my UI to look the same across platforms with both Flutter and React Native. Flutter ships with its own graphics engine, so you’d think everything would be identical wherever you go. But I did notice a couple of differences in spacing and alignment between the web, MacOS, and iOS outputs that I wasn’t able to fix. Though they were very minor, single-pixel differences — I doubt an end user would even notice — they did make me twitch a little.</p><p>Since React Native renders native components on each platform, there’s almost no way for it to have fewer consistency issues than Flutter. And sure enough, I spent most of one Sunday cursing at my computer over an app bar that worked fine on web but disappeared and crashed the debugger on iOS, with no helpful error messages in sight. The problem ended up being an intersection of issues between my iPhone 12 simulator, a third-party design library I was using, and some custom styles. I have yet to encounter anything quite that elusive with Flutter.</p><p>Speaking of styles, React Native uses CSS. It’s slightly more complicated than that, but if you’re comfortable with CSS (and, importantly, <a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/">flexbox</a>) you’ll be right at home making things look however you want in React Native. Flutter’s styling mechanism, though different, isn’t entirely foreign — most CSS-like properties are represented by widget fields of the same name, and the Column and Row widgets are straightforward stand-ins for flex layouts. Still, you’ll probably have to look up each thing you’re trying to do or peek at widget code rather than plugging in some CSS properties and going on your merry way. The compositional paradigm of Flutter also takes some getting used to; a lot of the things you might usually apply with a CSS property have their own widget in Flutter.</p><p>Both frameworks are very customizable. If you’ve got pixel-perfect designs to work from, you’ll quickly get into the groove of building components to match.</p><h3>Performance: Responsive UX and animations</h3><p>Flutter’s big selling point from the very beginning has been speed. The framework’s marketing demos are full of sweeping full-screen animations that never miss a frame. And, from my experience building a simple game with it, I can vouch for its ability to handle whatever you throw at it. It’s smooth. In fact, the reason I turned to Flutter in the first place was because I was tired of watching sprites glitch and stagger across the screen on an HTML5 canvas.</p><p>That isn’t to say Flutter will ever be faster than a native app. Even if the performance is visually similar to native, you’ve still got a full non-native rendering engine running on top of the hardware. At the very least you’re going to be using more memory.</p><p>React Native doesn’t put up much of a fight in the performance category. It’s interpreting JavaScript in the background, then playing middleman between a JavaScript engine and native code. We already know JavaScript is relatively slow. This adds a whole new translation layer to it.</p><p>That said, both are more than fast enough. I wouldn’t recommend trying to build an immersive first-person shooter in either (although Flutter would doubtless manage it better) but that’s not what you’re here for, is it? When we’re talking about text forms and business logic, there’s no point quibbling over ten or twenty milliseconds of response time. The decisions you make as a programmer will make far more impact on the user experience than the framework running under the hood.</p><p>The one caveat to this is animation. The Flutter team has worked hard to make their framework synonymous with beautiful, touch-responsive animations. If you want to build an app that surrounds the user with ripples and flourishes, Flutter is where it’s at.</p><h3>Pipelines: Building and releasing your app</h3><p>Perhaps the single biggest thing keeping React Native developers from jumping ship is <a href="https://expo.dev/">Expo</a>. Expo is a private company that provides developer tooling and services for React Native apps, including a managed cross-platform runtime, native API modules, and an automatic deployment tool for both app stores. Expo also provides an app called Expo Go that lets you test your apps on a smartphone without sideloading or using a wired connection; just point your camera at a generated QR code and you’re all set. It’s an impressive offering.</p><p>Flutter doesn’t have an equivalent service. There’s <a href="https://fastlane.tools/">fastlane</a>, which fills some of the gaps in the release automation department, and of course Flutter has a cross-platform runtime built in. But if you want to test your Flutter apps on a physical smartphone you’ll have to plug it into your laptop and move some .apk or .ipa files around (or have your IDE move them for you). Both Android and iPhone have good first-party simulators available, so you won’t necessarily be doing this on a daily basis. But it is less convenient than using Expo Go.</p><h3>Developer experience: Being in the trenches</h3><p>This section will be more subjective than the others. I’m sure a lot of developers love the React Native experience, and plenty have their frustrations with Flutter. But for me, Flutter was so much easier to use and work with than React Native it was ridiculous. There are a few objective points in Flutter’s favor here — hot reloading, tighter VS Code integration, and more extensive built-in debugging tools — but I can’t say any of those were a deciding factor.</p><p>My proof-of-concept app consists of an app bar, a list of clickable tiles, a form with some numeric inputs, a few equations, and an output table. I had never built any of these things in either framework before.</p><p>It took me twice as long to build in React Native as in Flutter.</p><p>Most of that time is accounted for by head-scratching over basic things: project setup, icons, the disappearing app bar I mentioned earlier, cryptic CLI warnings, getting a controlled input to work. And since I built the React Native app first, there were a couple things I could copy and paste to save time on the Flutter app. But when I look back on the experience, the time difference isn’t even what stands out. It’s that I was almost constantly frustrated with React Native and almost constantly delighted with Flutter. Flutter always had what I needed and it worked perfectly. React Native pointed me to an NPM package and a Stack Overflow answer and said “good luck.”</p><p>Again, this is my own experience. I’m sure with time I’d get used to the quirks of React Native and discover things I dislike about Flutter. But there’s no question in my mind of what I want to use in the future: Flutter, every time.</p><p>Your mileage will vary. For an alternate perspective, <a href="https://shift.infinite.red/flutter-is-better-than-react-native-fed10c92a768">Jamon Holmgren’s article favoring React Native</a> is definitely worth a read. And <a href="https://www.youtube.com/watch?v=X8ipUgXH6jw">Fireship’s comparison video</a> provides a balanced perspective covering many of the same points I’ve talked about here.</p><h3>Summary: The best framework is the one you use</h3><p>If you’re looking for a smooth and integrated developer experience, all business implications aside, I can’t recommend Flutter highly enough. But there’s a lot of exciting news in the React Native camp these days and it makes a strong case for itself in terms of easier hiring and massive open-source community support. There’s more than enough buzz to go around; this year’s Stack Overflow Developer Survey has Flutter and React Native <a href="https://survey.stackoverflow.co/2022/#most-popular-technologies-misc-tech">neck-and-neck</a>, with RN slightly ahead in the “Professional Developers” category and Flutter slightly ahead in the “All Respondents” category. (Both are pretty far ahead of Ionic, Cordova, and Xamarin.)</p><p>Objectively speaking, there’s no clear winner here. You’ll pick a framework based on the needs and constraints of your app, just as you’d do with any technological decision. React Native clearly isn’t going anywhere, and a year from now the developer experience may be much improved thanks to the steady pace of community contributions. But for my money, Flutter is here to stay and will grow substantially in the short term as developers discover how powerful and easy to use it is.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3e2eb3524a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Serialization With JSON in Flutter]]></title>
            <link>https://medium.com/@ferguquang/serialization-with-json-in-flutter-f7e6c1e03fe2?source=rss-ef69529a93fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7e6c1e03fe2</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[serialization]]></category>
            <category><![CDATA[json]]></category>
            <category><![CDATA[json-serialization]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <dc:creator><![CDATA[Quang Ngo Duc]]></dc:creator>
            <pubDate>Sun, 11 Dec 2022 16:02:20 GMT</pubDate>
            <atom:updated>2022-12-11T16:02:20.369Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c1MVMcflQoE7K_-FESvLTQ.jpeg" /></figure><p>In this chapter, you’ll learn how to serialize JSON data into model classes. A model class represents data for a particular object. An example is a recipe model class, which usually has a title, an ingredient list and steps to cook it.</p><p>You’ll continue with the previous project, which is the starter project for this chapter, and you’ll add a class that models a recipe and its properties. Then you’ll integrate that class into the existing project.</p><p>By the end of the chapter, you’ll know:</p><ul><li>How to serialize JSON into model classes.</li><li>How to use Dart tools to automate the generation of model classes from JSON.</li></ul><p><strong>What is JSON?</strong></p><p>JSON, which stands for <strong>JavaScript Object Notation</strong>, is an open-standard format used on the web and in mobile clients. It’s the most widely used format for Representational State Transfer (REST)-based APIs that servers provide (https:// en.wikipedia.org/wiki/Representational_state_transfer). If you talk to a server that has a REST API, it will most likely return data in a JSON format. An example of a JSON response looks something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*m5AmfmbOuPT69In2W6zjnw.png" /></figure><p>That is an example recipe response that contains two fields inside a recipe object.</p><p>While it’s possible to treat the JSON as just a long string and try to parse out the data, it’s much easier to use a package that already knows how to do that. Flutter has a built-in package for decoding JSON, but in this chapter, you’ll use the <strong>json_serializable </strong>and <strong>json_annotation </strong>packages to help make the process easier.</p><p>Flutter’s built-in <strong>dart:convert </strong>package contains methods like json.decode and json.encode, which converts a JSON string to a Map&lt;String, dynamic&gt; and back. While this is a step ahead of manually parsing JSON, you’d still have to write extra code that takes that map and puts the values into a new class.</p><p>The json_serializable package comes in handy because it can generate model classes for you according to the annotations you provide via json_annotation. Before taking a look at automated serialization, you’ll see in the next section what manual serialization entails.</p><p><strong>Writing the code yourself</strong></p><p>So how do you go about writing code to serialize JSON yourself? Typical model classes have toJson() and fromJson() methods, so you’ll start with those.</p><p>To convert the JSON above to a model class, you’d first create a Recipe model class:</p><pre>class Recipe {<br>  final String uri;<br>  final String label;<br><br>  Recipe({this.uri, this.label});<br>}</pre><p>You don’t need to type this into your project, since in the next section you’ll instead switch to automated serialization.</p><p>Then you’d add toJson() and fromJson() factory methods:</p><pre>factory Recipe.fromJson(Map&lt;String, dynamic&gt; json) {<br> return Recipe(json[&#39;uri&#39;] as String, json[&#39;label&#39;] as String);<br>}</pre><pre>Map&lt;String, dynamic&gt; toJson() {<br> return &lt;String, dynamic&gt;{ &#39;uri&#39;: uri, &#39;label&#39;: label}<br>}</pre><p>In fromJson(), you grab data from the JSON map variable named json and convert it to arguments you pass to the Recipe constructor. In toJson(), you construct a map using the JSON field names.</p><p>While it doesn’t take much effort to do that by hand for two fields, what if you had multiple model classes, each with, say, five fields, or more? What if you renamed one of the fields? Would you remember to rename all of the occurrences of that field?</p><p>The more model classes you have, the more complicated it becomes to maintain the code behind them. Fear not, that’s where automated code generation comes to the rescue.</p><p><strong>Automating JSON serialization</strong></p><p>You’ll use two packages in this chapter: json_annotation and json_serializable from Google.</p><p>You use the first to add annotations to model classes so that json_serializable can generate helper classes to convert JSON from a string to a model and back.</p><p>To do that, you mark a class with the @JsonSerializable() annotation so the builder package can generate code for you. Each field in the class should either have the same name as the field in the JSON string or use the @JsonKey() annotation to give it a different name.</p><p>Most builder packages work by importing what’s called a <strong>.part </strong>file. That will be a file that is generated for you. All you need to do is create a few factory methods which will call the generated code.</p><h3><strong>Key points</strong></h3><ul><li>JSON is an open-standard format used on the web and in mobile clients, especially with REST APIs.</li><li>In mobile apps, JSON code is usually parsed into the model objects that your app will work with.</li><li>You can write JSON parsing code yourself, but it’s usually easier to let a JSON package generate the parsing code for you.</li><li><strong>json_annotation </strong>and <strong>json_serializable </strong>are packages that will let you generate the parsing code.</li></ul><p><strong>Where to go from here?</strong></p><p>In this chapter, you’ve learned how to create models that you can parse from JSON and then use when you fetch JSON data from the network. If you want to learn more about json_serializable, go to <a href="https://pub.dev/packages/json_serializable.">https://pub.dev/packages/json_serializable.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7e6c1e03fe2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Realtime using SocketIO in Flutter]]></title>
            <link>https://medium.com/@ferguquang/realtime-using-socketio-in-flutter-fbc6975ec82b?source=rss-ef69529a93fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/fbc6975ec82b</guid>
            <category><![CDATA[real-time-communication]]></category>
            <category><![CDATA[socketio]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Quang Ngo Duc]]></dc:creator>
            <pubDate>Sun, 07 Aug 2022 08:56:26 GMT</pubDate>
            <atom:updated>2022-08-07T08:56:26.615Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BvbKi33PgcqlyxuxoGP_-g.png" /></figure><h3>Introduction</h3><h3>What Socket.IO is<a href="https://socket.io/docs/v4/client-initialization/#what-socketio-is">​</a></h3><p>Socket.IO is a library that enables low-latency, bidirectional and event-based communication between a client and a server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*_pZShX0eCWIzCA0xgAKZAA.png" /></figure><p>It is built on top of the <a href="https://en.wikipedia.org/wiki/WebSocket">WebSocket</a> protocol and provides additional guarantees like fallback to HTTP long-polling or automatic reconnection.</p><p>INFO</p><p>WebSocket is a communication protocol which provides a full-duplex and low-latency channel between the server and the browser. More information can be found <a href="https://en.wikipedia.org/wiki/WebSocket">here</a>.</p><h3>What Socket.IO is not</h3><p>CAUTION</p><p>Socket.IO is NOT a WebSocket implementation.</p><p>Although Socket.IO indeed uses WebSocket for transport when possible, it adds additional metadata to each packet. That is why a WebSocket client will not be able to successfully connect to a Socket.IO server, and a Socket.IO client will not be able to connect to a plain WebSocket server either.</p><h3>Features<a href="https://socket.io/docs/v4/client-initialization/#features">​</a></h3><p>Here are the features provided by Socket.IO over plain WebSockets:</p><h3>HTTP long-polling fallback<a href="https://socket.io/docs/v4/client-initialization/#http-long-polling-fallback">​</a></h3><p>The connection will fall back to HTTP long-polling in case the WebSocket connection cannot be established.</p><p>This feature was the #1 reason people used Socket.IO when the project was created more than ten years ago (!), as the browser support for WebSockets was still in its infancy.</p><p>Even if most browsers now support WebSockets (more than <a href="https://caniuse.com/mdn-api_websocket">97%</a>), it is still a great feature as we still receive reports from users that cannot establish a WebSocket connection because they are behind some misconfigured proxy.</p><h3>Automatic reconnection<a href="https://socket.io/docs/v4/client-initialization/#automatic-reconnection">​</a></h3><p>Under some particular conditions, the WebSocket connection between the server and the client can be interrupted with both sides being unaware of the broken state of the link.</p><p>That’s why Socket.IO includes a heartbeat mechanism, which periodically checks the status of the connection.</p><p>And when the client eventually gets disconnected, it automatically reconnects with an exponential back-off delay, in order not to overwhelm the server.</p><pre>Without further ado, I&#39;ll start right away with a Flutter app using SocketIO</pre><h3>Use this package as a library</h3><h3>Depend on it</h3><p>Run this command:</p><p>With Dart:</p><pre><strong>$ </strong>dart pub add socket_io_client</pre><p>With Flutter:</p><pre><strong>$ </strong>flutter pub add socket_io_client</pre><p>This will add a line like this to your package’s pubspec.yaml (and run an implicit dart pub get):</p><pre>dependencies:<br>  socket_io_client: ^2.0.0</pre><p>Alternatively, your editor might support dart pub get or flutter pub get. Check the docs for your editor to learn more.</p><p>Create socket_io_manager.dart:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bed88a741ff84fd604a9239542692c30/href">https://medium.com/media/bed88a741ff84fd604a9239542692c30/href</a></iframe><h3>Usage with stream and streambuilder in Flutter</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/caeee5a4920da0978f52a525307b7541/href">https://medium.com/media/caeee5a4920da0978f52a525307b7541/href</a></iframe><p>In the above article, I gave you a basic guide to SocketIO on Flutter.</p><p>Hope to help you in real projects.</p><p>Thank you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fbc6975ec82b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create Base Screen using Abstract class in Flutter]]></title>
            <link>https://medium.com/@ferguquang/create-base-screen-using-abstract-class-in-flutter-f61a5ae02bcd?source=rss-ef69529a93fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/f61a5ae02bcd</guid>
            <category><![CDATA[mixin]]></category>
            <category><![CDATA[base-screen]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[abstract]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Quang Ngo Duc]]></dc:creator>
            <pubDate>Sun, 07 Aug 2022 08:29:45 GMT</pubDate>
            <atom:updated>2022-08-07T08:29:45.907Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*lv3AQAfAsOZ3tNWss2V-jg.jpeg" /></figure><p>In the process of developing mobile applications using Flutter, you will have to develop a lot of screens. Properties like Appbar, background, color, loading, … always have to be in 1 screen, so you just need to code in this base class, and use them in other classes.</p><p>In this article I will write a base screen class for the purpose of reducing the amount of code for you as well as the maintenance for later, it’s easy to modify because you just need to fix it here and other screens will also be applied.</p><pre><strong>I will put the code below, then I will explain it to you</strong></pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cc815b3a9dcf21ffe58fba681757e047/href">https://medium.com/media/cc815b3a9dcf21ffe58fba681757e047/href</a></iframe><p>BasePageScreenState contains functions that will let you access the base, you can customize them as needed.</p><p>Mixin BaseScreen for you to generate the UI base. I write the body function to contain your interface code for different screens.</p><h3><strong>Using</strong></h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2407f36b61688390501d613dd364e02f/href">https://medium.com/media/2407f36b61688390501d613dd364e02f/href</a></iframe><p>You can create a lot of screen files, then using this base class, I find this is a very important thing in large projects, containing many screens, you can manage it in the best way.</p><p>Hope this article will bring many benefits to you.</p><p>Thank you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f61a5ae02bcd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Event Bus in Flutter — Send and listen data easily]]></title>
            <link>https://medium.com/@ferguquang/event-bus-in-flutter-send-and-listen-data-easily-a7d506366d2c?source=rss-ef69529a93fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7d506366d2c</guid>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[eventbus]]></category>
            <category><![CDATA[send-data]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Quang Ngo Duc]]></dc:creator>
            <pubDate>Sun, 10 Jul 2022 09:41:47 GMT</pubDate>
            <atom:updated>2022-07-10T09:41:47.701Z</atom:updated>
            <content:encoded><![CDATA[<h3>Event Bus in Flutter — Send and listen data easily</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h9fw9-AbGIqjEskbK-Rf6A.png" /></figure><h3>Problems and Solutions</h3><p>As your Flutter project has grown, the widgets you build have become very complex and overlapping, sending and listening for events will become more difficult and complex.</p><p>Today, I will introduce you to a library that can solve this problem in an extremely easy way : use <strong>Event Bus</strong>.</p><h3>Event Bus Pattern</h3><p>An Event Bus follows the publish/subscribe pattern. It allows listeners to subscribe for events and publishers to fire events. This enables objects to interact without requiring to explicitly define listeners and keeping track of them.</p><h3>Event Bus and MVC</h3><p>The Event Bus pattern is especially helpful for decoupling <a href="https://wikipedia.org/wiki/Model_View_Controller">MVC</a> (or <a href="https://wikipedia.org/wiki/Model_View_Presenter">MVP</a>) applications.</p><p>One group of MVC is not a problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/1*uUWCxH109DZcVYFhQtbqbw.png" /></figure><p>But as soon as there are multiple groups of MVCs, those groups will have to talk to each other. This creates a tight coupling between the controllers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*znDZPrt1uzRDTJ07OSBXcA.png" /></figure><p>By communication through an Event Bus, the coupling is reduced.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*AMIwhoyG-R5Cl3K5wkp8JA.png" /></figure><h3>Use this package as a library</h3><h3>Depend on it</h3><p>Run this command:</p><p>With Dart:</p><pre><strong>$ </strong>dart pub add event_bus</pre><p>With Flutter:</p><pre><strong>$ </strong>flutter pub add event_bus</pre><p>This will add a line like this to your package’s pubspec.yaml (and run an implicit dart pub get):</p><pre>dependencies:<br>  event_bus: ^2.0.0</pre><p>Alternatively, your editor might support dart pub get or flutter pub get. Check the docs for your editor to learn more.</p><p><strong>How to use in Project?</strong></p><h3>1. Create an Event Bus</h3><p>Create an instance of EventBus and make it available to other classes.</p><p>Usually there is just one Event Bus per application, but more than one may be set up to group a specific set of events.</p><pre><strong>import</strong> &#39;package:event_bus/event_bus.dart&#39;;</pre><pre>EventBus eventBus = EventBus();</pre><p>Note: <em>The default constructor will create an asynchronous event bus. To create a synchronous bus you must provide the optional </em><em>sync: true attribute.</em></p><h3>2. Define Events</h3><p>Any Dart class can be used as an event.</p><pre>class EventSendData {<br>  String? name;<br>  int? id;<br><br>  EventSendData({this.name, this.id});<br>}</pre><h3>3. Register Listeners</h3><p>Register listeners for specific events:</p><pre>eventBus.<strong>on</strong>&lt;UserLoggedInEvent&gt;().listen((event) {<br>  <em>// All events are of type UserLoggedInEvent (or subtypes of it).</em><br>  print(event.user);<br>});</pre><p>Register listeners for all events:</p><pre>eventBus.<strong>on</strong>().listen((event) {<br>  <em>// Print the runtime type. Such a set up could be used for logging.</em><br>  print(event.runtimeType);<br>});</pre><h4>About Dart Streams</h4><p>EventBus uses Dart <a href="https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:async.Stream">Streams</a> as its underlying mechanism to keep track of listeners. You may use all functionality available by the <a href="https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:async.Stream">Stream</a> API. One example is the use of <a href="https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:async.StreamSubscription">StreamSubscriptions</a> to later unsubscribe from the events.</p><pre>StreamSubscription loginSubscription = eventBus.<strong>on</strong>&lt;UserLoggedInEvent&gt;().listen((event) {<br>  print(event.user);<br>});</pre><pre>loginSubscription.cancel();</pre><h3>4. Fire Events</h3><p>Finally, we need to fire an event.</p><pre>eventBus.fire(EventSendData(id: 1, name: &quot;Value you want to send&quot;));</pre><h3>Using Custom Stream Controllers</h3><p>Instead of using the default StreamController you can use the following constructor to provide your own.</p><p>An example would be to use an <a href="https://pub.dev/packages/rxdart">RxDart</a> Subject as the controller.</p><pre><strong>import</strong> &#39;package:rxdart/rxdart.dart&#39;;</pre><pre>EventBus behaviorBus = EventBus.customController(BehaviorSubject());</pre><h3>Example</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/66db4891e8a4c3ccf49f4756a3d2442a/href">https://medium.com/media/66db4891e8a4c3ccf49f4756a3d2442a/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e8881c92e2542d66f5c041b096a44bda/href">https://medium.com/media/e8881c92e2542d66f5c041b096a44bda/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/55975e1ee0c894035df3b50ca6d3eb0d/href">https://medium.com/media/55975e1ee0c894035df3b50ca6d3eb0d/href</a></iframe><p>Thank you for reading, I would be happy to receive your support.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7d506366d2c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Save data when the app is running in the background — Use Flutter Secure Storage]]></title>
            <link>https://medium.com/@ferguquang/save-data-when-the-app-is-running-in-the-background-use-flutter-secure-storage-ffc3afa0b436?source=rss-ef69529a93fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/ffc3afa0b436</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[save-data]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[save-data-in-background]]></category>
            <category><![CDATA[app-is-running-background]]></category>
            <dc:creator><![CDATA[Quang Ngo Duc]]></dc:creator>
            <pubDate>Sun, 10 Jul 2022 08:38:11 GMT</pubDate>
            <atom:updated>2022-07-10T09:12:28.802Z</atom:updated>
            <content:encoded><![CDATA[<h3>Save data when the app is running in the background in Flutter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QUg1J6QKeA1QV15M5F0eXw.jpeg" /><figcaption>Save data when app is running in the background</figcaption></figure><pre>Problems and Solutions</pre><p>Maybe you are too familiar with the libraries that store data in Flutter applications such as: Hive, Share Preference, … These applications are very good to use, but you have used them when your application in the background yet?</p><p>I have tried many ways but still can’t save the data when the app is running in the background.</p><p>And today I will introduce to you a library that can solve that problem.</p><p>Let’s get started!</p><p>A Flutter plugin to store data in secure storage:</p><ul><li><a href="https://developer.apple.com/library/content/documentation/Security/Conceptual/keychainServConcepts/01introduction/introduction.html#//apple_ref/doc/uid/TP30000897-CH203-TP1">Keychain</a> is used for iOS</li><li>AES encryption is used for Android. AES secret key is encrypted with RSA and RSA key is stored in <a href="https://developer.android.com/training/articles/keystore.html">KeyStore</a></li><li>With V5.0.0 we can use <a href="https://developer.android.com/topic/security/data">EncryptedSharedPreferences</a> on Android by enabling it in the Android Options like so:</li></ul><pre>AndroidOptions _getAndroidOptions() =&gt; <strong>const</strong> AndroidOptions(<br>        encryptedSharedPreferences: <strong>true</strong>,<br>      );</pre><p>For more information see the example app.</p><ul><li><a href="https://wiki.gnome.org/Projects/Libsecret">libsecret</a> is used for Linux.</li></ul><p><em>Note</em> KeyStore was introduced in Android 4.3 (API level 18). The plugin wouldn&#39;t work for earlier versions.</p><h3>Use this package as a library</h3><h3>Depend on it</h3><p>Run this command:</p><p>With Flutter:</p><pre><strong>$ </strong>flutter pub add flutter_secure_storage</pre><p>This will add a line like this to your package’s pubspec.yaml (and run an implicit flutter pub get):</p><pre>dependencies:<br>  flutter_secure_storage: ^5.0.2</pre><p>Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.</p><pre>Now, we need an admin class for you to save and retrieve data</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/47adbdbd32ea69a57f57fa2986bbcecf/href">https://medium.com/media/47adbdbd32ea69a57f57fa2986bbcecf/href</a></iframe><p><strong>Save data</strong></p><pre>SecureStorageManager.<em>instance</em>.saveData(key: &quot;yourKey&quot;, value: &quot;yourValue&quot;);</pre><p>Get data</p><pre>String? value = await SecureStorageManager.<em>instance</em>.getData(key: &quot;yourKey&quot;);</pre><p>Thank you for reading, I would be happy to receive your support.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ffc3afa0b436" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MVVM Architecture - MVVM Pattern in Flutter]]></title>
            <link>https://medium.com/@ferguquang/mvvm-architecture-mvvm-pattern-in-flutter-2af689e2744?source=rss-ef69529a93fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/2af689e2744</guid>
            <category><![CDATA[mvvm]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[mvvm-architecture]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Quang Ngo Duc]]></dc:creator>
            <pubDate>Sun, 03 Jul 2022 11:54:58 GMT</pubDate>
            <atom:updated>2022-07-22T14:44:36.902Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*Gjpi9SmKjKQbXqB0uxz_Cw.png" /><figcaption>MVVM Architecture</figcaption></figure><pre>Introduce</pre><p>The MVVM architecture in Flutter is one of the most used patterns in the process of building Flutter applications. To understand more about how to use this pattern, please follow this article.</p><p>MVVM Architecture: Short for Model — View — ViewModel. Is a model that supports two-way data binding (Two-way data binding) between View and ViewModel. Allows separation of data (Model), execution code (Logic or ViewModel) and user interface (View).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*qKF81ArIgIkFxIXAxvdi_Q.png" /><figcaption>MVVM Architecture</figcaption></figure><p><strong>Model</strong></p><p>Model is a component associated with the database, in the Model there are always functions to retrieve data from the database.</p><p><strong>View</strong></p><p>View or UI or Presentation Layer is the part of the application interface and receives user interaction. Another difference of View in MVVM is: the ability to perform behaviors and respond to users through binding, command.</p><p><strong>ViewModel</strong></p><ul><li>It is an intermediate layer between View and Model.</li><li>Considered as a component that replaces the Controller class in the MVC model.</li><li>The ViewModel does not know anything about its upper layer, nor does it know anything about the View.</li><li>A ViewModel can be used for many Views through binding data, which can be one- or two-way depending on the needs of the application.</li><li>The difference is that: In the ViewModel contains the code that implements Data Binding, Command.</li></ul><pre>MVVM Flutter Architecture Implementation</pre><p>In this example, I will take data from any API, then display the data to the view.</p><p>Create a new project and declare the latest library of :</p><pre>cupertino_icons: ^1.0.2<br>provider: ^6.0.3<br>dio: ^4.0.6<br>cached_network_image: ^3.2.0</pre><p>About the data, we will get it at <a href="https://api.randomuser.me/?results=50">https://api.randomuser.me/?results=50</a> This API provides the necessary information for us (for free). You need to convert this data to Dart object by going to the website <a href="https://javiercbk.github.io/json_to_dart/">https://javiercbk.github.io/json_to_dart/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cqFGEZb2-MqvVhgOy-M0_Q.png" /><figcaption>Convert Json to Dart Online</figcaption></figure><p>You copy this class into the model of your project</p><p><strong>data_sources</strong></p><p>Create file app_url:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/66d29623e46a05cbac1dd6167e4f923c/href">https://medium.com/media/66d29623e46a05cbac1dd6167e4f923c/href</a></iframe><p>Create file api_client.dart:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/54a10d3ce820324138f666606c0b7587/href">https://medium.com/media/54a10d3ce820324138f666606c0b7587/href</a></iframe><p><strong>view_models</strong></p><p>Create file user_view_models.dart</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/45babf9bc3e9230785d3dc5f99830096/href">https://medium.com/media/45babf9bc3e9230785d3dc5f99830096/href</a></iframe><p><strong>views</strong></p><p>Create file user_list_screen.dart và user_items.dart</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4b7f476e86461dfc1cb997a9538f3ec7/href">https://medium.com/media/4b7f476e86461dfc1cb997a9538f3ec7/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b11424d733e4ce6e675f30a0f9ef45fb/href">https://medium.com/media/b11424d733e4ce6e675f30a0f9ef45fb/href</a></iframe><pre>Conclusion</pre><p>MVVM architecture in Flutter is one of the commonly used architectures not only in Flutter but also in other mobile programming platforms, especially native.</p><p>Hope this article will make you better understand how MVVM model works in Flutter in particular, and programming in general.</p><p>Thank you very much.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2af689e2744" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Realtime using SignalR in Flutter]]></title>
            <link>https://medium.com/@ferguquang/realtime-using-signalr-in-flutter-17a6111c57e?source=rss-ef69529a93fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/17a6111c57e</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[realtime]]></category>
            <category><![CDATA[net-core]]></category>
            <category><![CDATA[chat]]></category>
            <category><![CDATA[signalr]]></category>
            <dc:creator><![CDATA[Quang Ngo Duc]]></dc:creator>
            <pubDate>Sat, 25 Jun 2022 14:55:29 GMT</pubDate>
            <atom:updated>2022-06-25T14:55:29.483Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*bILb9xN1RPJrdEnrcDDG6w.jpeg" /></figure><h3>What is SignalR?</h3><p>A Flutter SignalR Client for <a href="https://docs.microsoft.com/aspnet/core/signalr">ASP.NET Core</a>.<br>ASP.NET Core SignalR is an open-source library that simplifies adding real-time web functionality to apps. Real-time web functionality enables server-side code to push content to clients instantly.</p><p>Tested with ASP.NET Core 3.1 &amp; ASP .NET Core 6</p><p>The client is able to invoke server side hub functions (including streaming functions) and to receive method invocations issued by the server. It also supports the auto-reconnect feature.</p><p>The client supports the following transport protocols:</p><ul><li>WebSocket</li><li>Service Side Events</li><li>Long Polling</li></ul><p>The client supports the following hub protocols:</p><ul><li>Json</li><li>MessagePack</li></ul><p>ASP.NET SignalR is a library for ASP.NET developers that simplifies the process of adding real-time web functionality to applications. Real-time web functionality is the ability to have server code push content to connected clients instantly as it becomes available, rather than having the server wait for a client to request new data.</p><p>SignalR can be used to add any sort of “real-time” web functionality to your ASP.NET application. While chat is often used as an example, you can do a whole lot more. Any time a user refreshes a web page to see new data, or the page implements <a href="http://en.wikipedia.org/wiki/Push_technology#Long_polling">long polling</a> to retrieve new data, it is a candidate for using SignalR. Examples include dashboards and monitoring applications, collaborative applications (such as simultaneous editing of documents), job progress updates, and real-time forms.</p><p>SignalR also enables completely new types of web applications that require high frequency updates from the server, for example, real-time gaming.</p><p>SignalR provides a simple API for creating server-to-client remote procedure calls (RPC) that call JavaScript functions in client browsers (and other client platforms) from server-side .NET code. SignalR also includes API for connection management (for instance, connect and disconnect events), and grouping connections.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*aTJpnUeDj3LGX9bowiT48g.png" /></figure><p>SignalR handles connection management automatically, and lets you broadcast messages to all connected clients simultaneously, like a chat room. You can also send messages to specific clients. The connection between the client and server is persistent, unlike a classic HTTP connection, which is re-established for each communication.</p><p>SignalR supports “server push” functionality, in which server code can call out to client code in the browser using Remote Procedure Calls (RPC), rather than the request-response model common on the web today.</p><p>SignalR applications can scale out to thousands of clients using built-in, and third-party scale-out providers.</p><h3>SignalR and WebSocket</h3><p>SignalR uses the new WebSocket transport where available and falls back to older transports where necessary. While you could certainly write your app using WebSocket directly, using SignalR means that a lot of the extra functionality you would need to implement is already done for you. Most importantly, this means that you can code your app to take advantage of WebSocket without having to worry about creating a separate code path for older clients. SignalR also shields you from having to worry about updates to WebSocket, since SignalR is updated to support changes in the underlying transport, providing your application a consistent interface across versions of WebSocket.</p><pre>I won&#39;t be verbose anymore. I will show you how to configure SignalR into your Flutter project</pre><h3>Use this package as a library</h3><h3>Depend on it</h3><p>Run this command:</p><p>With Flutter:</p><pre><strong>$ </strong>flutter pub add signalr_netcore</pre><p>This will add a line like this to your package’s pubspec.yaml (and run an implicit flutter pub get):</p><pre>dependencies:<br>  signalr_netcore: ^1.3.0</pre><p>Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.</p><p>Now in your Dart code, you can use:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/04a633f4dc43f74d46010e0d2a1cd09a/href">https://medium.com/media/04a633f4dc43f74d46010e0d2a1cd09a/href</a></iframe><p>Thank you for reading, I would be happy to receive your support.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17a6111c57e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is SharedPreferences in Flutter?]]></title>
            <link>https://medium.com/@ferguquang/what-is-sharedpreferences-in-flutter-a07e0142cbbd?source=rss-ef69529a93fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/a07e0142cbbd</guid>
            <category><![CDATA[save-data]]></category>
            <category><![CDATA[preference-share]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[android-ios]]></category>
            <dc:creator><![CDATA[Quang Ngo Duc]]></dc:creator>
            <pubDate>Sat, 25 Jun 2022 14:33:54 GMT</pubDate>
            <atom:updated>2022-06-25T14:33:54.884Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mb7daDENy0QzxWJ_Cx1X9w.jpeg" /><figcaption>Save data in your project</figcaption></figure><pre>Define</pre><p>SharedPreferences is an Android and iOS application used for simple data storage in allocated space.</p><p>This data persists even when the application is shut down and restarted; we can still get the original value back.</p><p>Data stored in SharedPreferences can be edited and deleted. SharedPreferences stores data in a key-value pair.</p><pre>Install SharedPreferences</pre><p><a href="https://pub.dev/packages/shared_preferences">shared_preferences | Flutter package</a></p><p>The usage is detailed in pubdev, I won’t repeat it too much. I will share the code base that I have developed to help programmers save time.</p><pre>Below is a base class, we can use it anywhere in your project</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/634acdccfeede2f0ae10693984342650/href">https://medium.com/media/634acdccfeede2f0ae10693984342650/href</a></iframe><p><strong>How to save?</strong></p><pre>SharedPreferencesClass.<em>save</em>(&quot;Token&quot;, &quot;yourToken&quot;);</pre><p><strong>How to get?</strong></p><pre>String token = await SharedPreferencesClass.<em>get</em>(&quot;Token&quot;);</pre><p>Very simple right?</p><p>Thank you for reading, I would be happy to receive your support.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a07e0142cbbd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Push Communication Notification in IOS 15]]></title>
            <link>https://medium.com/@ferguquang/push-communication-notification-in-ios-15-fd17bd5cba43?source=rss-ef69529a93fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd17bd5cba43</guid>
            <category><![CDATA[push-notification-service]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[communication]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Quang Ngo Duc]]></dc:creator>
            <pubDate>Tue, 21 Jun 2022 15:02:24 GMT</pubDate>
            <atom:updated>2022-06-22T08:55:01.142Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sfn3quw2_vkJnN5s9oLH9Q.jpeg" /><figcaption>Custom icon app when push notification (Communication Notification)</figcaption></figure><pre>Opening</pre><p>Are you familiar with the usual Push Notification form of IOS, IOS can only display the App Icon, Title, Sub Title, Body?</p><p>Today I will introduce to everyone a new feature on iOS 15 and above: Communication Notification: you can change the Notification app Icon as you want (currently the icon will be the URL of the image taken from the Sever).</p><p>Currently I have used a lot of applications, 95% of the applications that I have installed do not have this feature, even Facebook, Instagram, Messenger, Google I have not seen this feature yet. On Apple’s homepage, there is an introduction to Communication Notification, but really, for longtime iOS developers, it is also difficult to understand, Apple does not provide detailed instructions on this feature for developers. Therefore, I will share in detail how I developed this feature.</p><pre>Things to prepare</pre><ul><li>Basic knowledge of Mobile (Android/IOS)</li><li>MacOS (Xcode)</li><li>Firebase Cloud Message (I will use Firebase to make push notification server to IOS devices)</li></ul><pre>Note</pre><p>There are a few features that I will not guide in detail, because those features have been used by too many articles and developers, you just need to search and there will be a lot of results.</p><pre>Let&#39;s get started now</pre><ul><li>Create your Project IOS: you can use Native or Hybrid (Flutter/React Native, …)</li><li>Config Firebase Cloud Message for iOS devices (you can see instructions in many articles)</li><li>Create NotificationService:</li></ul><p>Xcode -&gt; File -&gt; Target</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RrYSn5AaokZghBigTOtVlQ.png" /></figure><p>Set name this Service is NotificationService</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C6s2qZJq_BR8ceYKSvVxFQ.png" /></figure><ul><li>In your Notification Service Extension’s Info.plist, add this: NSExtension → NSExtensionAttributes (dictionary) → IntentsSupported (array) → INSendMessageIntent (string)</li><li>Enable the Communication Notifications capability on your main app target</li></ul><p>Now, I will conduct Push Notification from server to IOS device (using Firebase Cloud Message — <a href="https://fcm.googleapis.com/fcm/send">https://fcm.googleapis.com/fcm/send</a>). Below is the json string i use for push notification.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6146022824237159e025723e8e860ffa/href">https://medium.com/media/6146022824237159e025723e8e860ffa/href</a></iframe><p><strong>Notification Content</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1db5bff5014cd08631b2bf08478315f2/href">https://medium.com/media/1db5bff5014cd08631b2bf08478315f2/href</a></iframe><pre>Now run the code and push notification, you will be able to customize the image you want.</pre><p>Details of the files you need I will put in the git link below:</p><p><a href="https://github.com/ferguquang/communicationnotification">GitHub - ferguquang/communicationnotification</a></p><p>Good luck. This is my first time posting my article on Medium, for the purpose of sharing the knowledge I have done, if there is something wrong, please comment below so I can correct and improve myself. Thank you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd17bd5cba43" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>