<?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 MOHAMED SAFVAN KP on Medium]]></title>
        <description><![CDATA[Stories by MOHAMED SAFVAN KP on Medium]]></description>
        <link>https://medium.com/@mhdsafvankp?source=rss-dbdf79f46eac------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*-diSWTSSJsINTQGJ</url>
            <title>Stories by MOHAMED SAFVAN KP on Medium</title>
            <link>https://medium.com/@mhdsafvankp?source=rss-dbdf79f46eac------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 15:58:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mhdsafvankp/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[Deprecated imperative apply of Flutter’s Gradle plugins]]></title>
            <link>https://medium.com/@mhdsafvankp/deprecated-imperative-apply-of-flutters-gradle-plugins-1171ba16fccb?source=rss-dbdf79f46eac------2</link>
            <guid isPermaLink="false">https://medium.com/p/1171ba16fccb</guid>
            <category><![CDATA[plugins]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[gradle]]></category>
            <category><![CDATA[imperative]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[MOHAMED SAFVAN KP]]></dc:creator>
            <pubDate>Tue, 18 Mar 2025 10:05:25 GMT</pubDate>
            <atom:updated>2025-03-18T10:05:25.783Z</atom:updated>
            <content:encoded><![CDATA[<p>Support in stable release: 3.16.0 Recommended in stable release: 3.19.0</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*ik4ewpHp2HiEuWjVMz1TUw.png" /></figure><p>Hey Flutter Developers! 👋</p><h3><strong>🛠️ <em>Steps to UPGRADE</em></strong></h3><p><em>we need to update the following files:</em></p><p>📌 android/app/build.gradle</p><p>📌 android/build.gradle</p><p>📌 android/settings.gradle</p><blockquote>1️⃣ Update android/settings.gradle</blockquote><p><em>Before diving in, let’s find the </em><strong><em>Android Gradle Plugin (AGP)</em></strong><em> and </em><strong><em>Kotlin</em></strong><em> versions your project is using. Check </em><em>android/build.gradle</em>:</p><pre>dependencies {<br>        classpath &#39;com.android.tools.build:gradle:7.3.0&#39;<br>        classpath &quot;org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version&quot;<br>    }</pre><p>The AGP version is the number that comes at the end of the line classpath &#39;com.android.tools.build:gradle:7.3.0&#39;, so 7.3.0 in this case. Similarly, the Kotlin version comes at the end of the line ext.kotlin_version = &#39;1.7.10&#39;, in this case 1.7.10.</p><p>Next, replace the contents of &lt;app-src&gt;/android/settings.gradle with the following, remembering to replace {agpVersion} and {kotlinVersion} with previously identified values:</p><pre>pluginManagement {<br>    def flutterSdkPath = {<br>        def properties = new Properties()<br>        file(&quot;local.properties&quot;).withInputStream { properties.load(it) }<br>        def flutterSdkPath = properties.getProperty(&quot;flutter.sdk&quot;)<br>        assert flutterSdkPath != null, &quot;flutter.sdk not set in local.properties&quot;<br>        return flutterSdkPath<br>    }()<br><br>    includeBuild(&quot;$flutterSdkPath/packages/flutter_tools/gradle&quot;)<br><br>    repositories {<br>        google()<br>        mavenCentral()<br>        gradlePluginPortal()<br>    }<br>}<br><br>plugins {<br>    id &quot;dev.flutter.flutter-plugin-loader&quot; version &quot;1.0.0&quot;<br>    id &quot;com.android.application&quot; version &quot;{agpVersion}&quot; apply false<br>    id &quot;org.jetbrains.kotlin.android&quot; version &quot;{kotlinVersion}&quot; apply false<br>}<br><br>include &quot;:app&quot;</pre><p><em>If you made some changes to this file, make sure they’re placed after </em><em>pluginManagement {} and </em><em>plugins {} blocks, since Gradle enforces that no other code can be placed before these blocks.</em></p><blockquote>2️⃣ Delete the buildscript block from android/build.gradle</blockquote><p>Yes, just remove it. The new <strong>Plugin DSL</strong> takes care of everything now. Trust me, less is more. 🚀</p><p>Here’s how that file will likely end up:</p><pre>allprojects {<br>    repositories {<br>        google()<br>        mavenCentral()<br>    }<br>}<br><br>rootProject.buildDir = &#39;../build&#39;<br>subprojects {<br>    project.buildDir = &quot;${rootProject.buildDir}/${project.name}&quot;<br>}<br>subprojects {<br>    project.evaluationDependsOn(&#39;:app&#39;)<br>}<br><br>tasks.register(&quot;clean&quot;, Delete) {<br>    delete rootProject.buildDir<br>}</pre><blockquote>3️⃣ Update android/app/build.gradle</blockquote><p>Wave goodbye to apply plugin statements and welcome the <strong>Plugin DSL</strong> syntax 👋:</p><p><em>remove:</em></p><pre>apply plugin: &#39;com.android.application&#39;<br>apply plugin: &#39;com.jetbrains.kotlin.android&#39;<br>apply from: &quot;$flutterRoot/packages/flutter_tools/gradle/flutter.gradle&quot;</pre><p><em>replace: (U</em>sing the Plugin DSL syntax. At the very top of your file<em>)</em></p><pre>plugins {<br>    id &quot;com.android.application&quot;<br>    id &quot;kotlin-android&quot;<br>    id &quot;dev.flutter.flutter-gradle-plugin&quot;<br>}</pre><blockquote>4️⃣ Move Dependency Classpaths to Plugin DSL</blockquote><p>If you have extra dependencies (like Firebase), move them from dependencies to settings.gradle and app/build.gradle:</p><p><strong><em>Example:</em></strong></p><p>If your app was using Google Mobile Services and Crashlytics, remove the following lines from &lt;app-src&gt;/android/build.gradle:</p><p><em>Before:</em></p><pre>buildscript {<br>    // ...<br><br>    dependencies {<br>        // ...<br>        classpath &quot;com.google.gms:google-services:4.4.0&quot;<br>        classpath &quot;com.google.firebase:firebase-crashlytics-gradle:2.9.9&quot;<br>    }<br>}</pre><p><em>After:</em></p><blockquote>📌 <strong>In </strong><strong>settings.gradle:</strong></blockquote><pre>plugins {<br>    // ...<br>    id &quot;com.google.gms.google-services&quot; version &quot;4.4.0&quot; apply false<br>    id &quot;com.google.firebase.crashlytics&quot; version &quot;2.9.9&quot; apply false<br>    // ...<br>}</pre><blockquote>📌 <strong>In </strong><strong>android/app/build.gradle:</strong></blockquote><pre>plugins {<br>    // ...<br>    id &quot;com.google.gms.google-services&quot;<br>    id &quot;com.google.firebase.crashlytics&quot;<br>    // ...<br>}</pre><p><strong>✅ That’s it! 🎉</strong></p><blockquote>📚 References:</blockquote><p><a href="https://github.com/flutter/flutter/issues/135392">Add documentation for migrating Android build files to declarative form · Issue #135392 · flutter/flutter</a></p><p><a href="https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply">Deprecated imperative apply of Flutter’s Gradle plugins | Flutter</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1171ba16fccb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Boost Your Flutter App’s Performance! ]]></title>
            <link>https://medium.com/@mhdsafvankp/boost-your-flutter-apps-performance-aa2b98b60846?source=rss-dbdf79f46eac------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa2b98b60846</guid>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-widget]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[flutter-ui]]></category>
            <dc:creator><![CDATA[MOHAMED SAFVAN KP]]></dc:creator>
            <pubDate>Thu, 26 Dec 2024 03:49:24 GMT</pubDate>
            <atom:updated>2024-12-26T04:00:02.337Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ipbX82bqXA7QgDjk.png" /><figcaption>Boost Your Flutter App</figcaption></figure><blockquote>If you’re building apps with Flutter, making them fast and smooth is super important. Here are some simple tips I’ve used to improve performance in my projects:</blockquote><p>✅ <strong>Use State Management Smartly</strong>: Tools like BLoC or Provider can help reduce unnecessary rebuilds.</p><p>✅ <strong>Simplify Your UI</strong>: Keep the widget tree clean to make the app more responsive.</p><ul><li><strong>Reduce Widget Depth</strong>: Avoid deep nesting of widgets. Keep the structure flat and simple.</li><li><strong>Lazy Load Items</strong>: Use <strong>ListView.builder</strong> or <strong>GridView.builder</strong> to load items only when they appear on the screen.</li><li><strong>Limit Animations</strong>: Too many animations slow down the app. Use simple and smooth animations.</li><li><strong>Don’t Rebuild Everything</strong>: Update only the necessary parts of the UI instead of rebuilding the whole screen.</li></ul><p>✅ <strong>Cache Data</strong>: Save commonly used data locally with Hive or Shared Preferences to avoid extra API calls.</p><p>✅ <strong>Optimize Images</strong>: Compress images or use the right formats to load them faster.</p><ul><li><strong>Compress Image Assets</strong>: Use tools like TinyPNG or ImageOptim to reduce file sizes without losing quality before adding them to your app.</li><li><strong>Lazy Loading</strong>: Load images only when they’re visible on the screen using the Image.network() widget with placeholders.</li><li><strong>Use Caching</strong>: Use libraries cached_network_image to store and reuse downloaded images. This reduces redundant network requests and speeds up image loading.</li><li><strong>Use SVGs for Icons</strong>: For simple graphics and icons, consider using vector images (SVGs). They’re lightweight and scalable without losing quality.</li></ul><blockquote>By optimizing images, you can significantly reduce load times and memory usage, making your app faster and more efficient! 🚀</blockquote><p>✅ <strong>Track Performance</strong>: Use Flutter DevTools to find and fix slow parts of your app.</p><p>✅ <strong>Clean Up</strong>: Always release resources like controllers, streams, and listeners in the dispose() method to avoid memory leaks</p><p>✅ <strong>Handle Crashes</strong>: Regularly check crash reports and fix issues to ensure a smooth experience.</p><ul><li><strong>Monitor Crash Reports</strong>: Use tools like <strong>Firebase Crashlytics</strong> to track and get detailed crash reports. These tools help identify what went wrong and where the issue happened.</li><li><strong>Log Errors</strong>: Keep track of errors and logs in your app using logging tools like <strong>Logger</strong> in Flutter. This helps you understand what caused the crash before it happened.</li><li><strong>Handle Exceptions</strong>: Make sure to use try-catch blocks around risky operations (like network requests, file I/O, etc.) to catch and handle unexpected errors without crashing the app.</li><li><strong>Graceful Error Handling</strong>: Instead of letting the app crash, show friendly error messages or fallback UI to the user. This improves the user experience even when something goes wrong.</li></ul><p>These small changes can make a big difference in how your app feels to users. What’s your favorite way to improve performance in Flutter apps? Let’s share and learn together!</p><p>#Flutter #AppPerformance #MobileDevelopment #Dart</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa2b98b60846" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enhance Flutter App Performance with Debounce Logic]]></title>
            <link>https://medium.com/@mhdsafvankp/enhance-flutter-app-performance-with-debounce-logic-96003a011b3b?source=rss-dbdf79f46eac------2</link>
            <guid isPermaLink="false">https://medium.com/p/96003a011b3b</guid>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[flutter-widget]]></category>
            <category><![CDATA[android-development]]></category>
            <dc:creator><![CDATA[MOHAMED SAFVAN KP]]></dc:creator>
            <pubDate>Sat, 27 Apr 2024 13:51:24 GMT</pubDate>
            <atom:updated>2024-04-27T13:51:24.158Z</atom:updated>
            <content:encoded><![CDATA[<p>Are you struggling with laggy user interactions in your Flutter app? Say hello to debounce logic! 🚀</p><p>Debounce logic plays a vital role in improving the responsiveness and efficiency of Flutter applications. Whether handling user input or managing asynchronous tasks, debounce ensures that actions are executed at the right time, preventing unnecessary and potentially costly operations.</p><p>1. debounceWithKey:</p><p>debounceWithKey is a powerful method that ensures only the latest, unique callback is executed within a specified time frame. It associates each callback with a unique key, allowing for precise control over execution.</p><p>2. debounceSimple:</p><p>debounceSimple offers a straightforward solution for debouncing by executing only the latest callback within the given period. It simplifies the process without the need for unique keys.</p><p>Enhance your Flutter app’s performance by implementing these debounce methods today! 🎉</p><p>In these examples, you’ll find those two approaches:</p><pre>import &#39;dart:async&#39;;<br><br>void main() {<br>  // How to use it?<br><br>  var debounceSimple = DebounceSimple(const Duration(seconds: 1));<br>  var debounceWithKey = DebounceWithKey(const Duration(seconds: 1));<br><br><br>  /// examples<br>  /// [debounceSimple]<br>  /// expectation:<br>  /// it should execute the latest call back in the given period of time<br>  debounceSimple((){<br>    print(&#39;debounceSimple execute Callback 1&#39;);<br>  });<br>  debounceSimple((){<br>    print(&#39;debounceSimple execute Callback 2&#39;);<br>  });<br>  debounceSimple((){<br>    print(&#39;debounceSimple execute Callback 3&#39;);<br>  });<br>  debounceSimple((){<br>    print(&#39;&lt;------ debounceSimple --------&gt;\n&#39;);<br><br>    print(&#39;debounceSimple execute Callback 4 [latest]&#39;);<br>  });<br><br><br>  /// [debounceWithKey]<br>  /// expectation:<br>  /// it should execute the latest [unique] call back in the given period of time<br>  var key1 = &#39;key1&#39;;<br>  debounceWithKey(key1, () {<br>    print(&#39;debounceWithKey executed the Callback 1 of key1&#39;);<br>  });<br>  debounceWithKey(key1, () {<br>    print(&#39;debounceWithKey executed the Callback 2 of key1&#39;);<br>  });<br>  debounceWithKey(key1, () {<br>    print(&#39;debounceWithKey executed the Callback 3 of key1&#39;);<br>  });<br>  debounceWithKey(key1, () {<br>    print(&#39;\n&lt;------ debounceWithKey --------&gt;&#39;);<br>    print(&#39;&lt;------ keys used: key1, key2 , keys --------&gt;\n&#39;);<br><br>    print(&#39;debounceWithKey executed the Callback 4 [latest of key1]&#39;);<br>  });<br><br>  var key2 = &#39;key2&#39;;<br>  debounceWithKey(key2, () {<br>    print(&#39;debounceWithKey executed the Callback 1 of key2&#39;);<br>  });<br>  debounceWithKey(key2, () {<br>    print(&#39;debounceWithKey executed the Callback 2 of key2&#39;);<br>  });<br>  debounceWithKey(key2, () {<br>    print(&#39;debounceWithKey executed the Callback 3 of key2&#39;);<br>  });<br>  debounceWithKey(key2, () {<br>    print(&#39;debounceWithKey executed the Callback 4 [latest of key2]&#39;);<br>  });<br><br>  var key3 = &#39;key3&#39;;<br>  debounceWithKey(key3, () {<br>    print(&#39;debounceWithKey executed the Callback 1 of key3&#39;);<br>  });<br>  debounceWithKey(key3, () {<br>    print(&#39;debounceWithKey executed the Callback 2 of key3&#39;);<br>  });<br>  debounceWithKey(key3, () {<br>    print(&#39;debounceWithKey executed the Callback 3 of key3&#39;);<br>  });<br>  debounceWithKey(key3, () {<br>    print(&#39;debounceWithKey executed the Callback 4 [latest of key3]&#39;);<br>  });<br><br><br><br><br><br><br><br>}<br><br>/// A Debounce by considering the keys<br>class DebounceWithKey {<br>  Duration delay;<br>  Timer? _timer;<br>  final Map&lt;Object, Timer&gt; _keyTimers = {};<br><br>  DebounceWithKey(this.delay);<br><br>  call(Object key, void Function() callback) {<br>    if (_keyTimers.containsKey(key)) {<br>      _keyTimers[key]!.cancel();<br>    }<br><br>    _keyTimers[key] = Timer(delay, () {<br>      callback();<br>      _keyTimers.remove(key);<br>    });<br>  }<br><br>  dispose() {<br>    _timer?.cancel();<br>    _keyTimers.forEach((key, timer) {<br>      timer.cancel();<br>    });<br>    _keyTimers.clear();<br>  }<br>}<br><br>/// A Simple Debounce method<br>class DebounceSimple {<br>  Duration delay;<br>  Timer? _timer;<br><br>  DebounceSimple(<br>    this.delay,<br>  );<br><br>  call(void Function() callback) {<br>    _timer?.cancel();<br>    _timer = Timer(delay, callback);<br>  }<br><br>  dispose() {<br>    _timer?.cancel();<br>  }<br>}</pre><p>output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bNZyUa2-a1FaYbDm9ECYSw.png" /></figure><p>Feel free to reach out to me at <strong><em>mhdsafvankp@gmail.com</em></strong> if you have any questions or need further assistance.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96003a011b3b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>