<?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 Dipak Sonawane on Medium]]></title>
        <description><![CDATA[Stories by Dipak Sonawane on Medium]]></description>
        <link>https://medium.com/@sonawanedipak111?source=rss-4b69c85fef7b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Gp7FFSglSICD_SKBrmFAXg.png</url>
            <title>Stories by Dipak Sonawane on Medium</title>
            <link>https://medium.com/@sonawanedipak111?source=rss-4b69c85fef7b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 03:58:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sonawanedipak111/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[Integrating USB Camera with Agora SDK for Android Video Calls]]></title>
            <link>https://medium.com/@sonawanedipak111/integrating-usb-camera-with-agora-sdk-for-android-video-calls-3f7bdf8806db?source=rss-4b69c85fef7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f7bdf8806db</guid>
            <dc:creator><![CDATA[Dipak Sonawane]]></dc:creator>
            <pubDate>Wed, 06 Dec 2023 05:45:37 GMT</pubDate>
            <atom:updated>2023-12-06T05:45:37.649Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C6aL7RheWPl_3xlNskVg2g.jpeg" /></figure><p>In the era of advanced communication, the integration of USB cameras with Android devices has become essential for achieving superior video call quality. This blog post will guide you through the process of seamlessly incorporating a USB camera into your Android app and leveraging the Agora SDK for immersive video calls.</p><h4>Pre-Requisites</h4><p>Before diving into the integration process, ensure you have:</p><ul><li>Android development environment configured</li><li>Agora SDK integrated into your Android project</li><li>Access to a USB camera compatible with Android devices</li></ul><h4>Integrating the USB Camera</h4><p>Let’s quickly outline the steps to integrate a USB camera with your Android device:<br>Setting Up Permissions:</p><pre>if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {<br>    // Request camera permission<br>}<br></pre><p><strong>Initializing the Agora RtcEngine:</strong></p><p>This dependency grants access to the full Agora SDK, enabling seamless integration of real-time communication features such as video calling, voice calling, and more within your Android application.</p><p>For integrating the Agora SDK, include the following dependency:</p><pre>implementation &#39;io.agora.rtc:full-sdk:3.4.7.3&#39;</pre><pre>  // Initialize the Agora RtcEngine<br>        try {<br>            mRtcEngine = RtcEngine.create(getApplicationContext(), getString(&quot;YOUR_APP_ID), mRtcEventHandler);<br>        } catch (Exception e) {<br>            Log.e(TAG, Log.getStackTraceString(e));<br>            throw new RuntimeException(&quot;Agora RtcEngine initialization failed.&quot;);<br>        }<br><br>        mRtcEngine.enableVideo();<br>        mRtcEngine.setClientRole(IRtcEngineEventHandler.ClientRole.CLIENT_ROLE_BROADCASTER);<br>        mRtcEngine.enableAudio();<br>        mRtcEngine.setEnableSpeakerphone(true);<br><br>        mRtcEngine.setVideoEncoderConfiguration(new VideoEncoderConfiguration(VideoEncoderConfiguration.VD_640x360, VideoEncoderConfiguration.FRAME_RATE.FRAME_RATE_FPS_30, VideoEncoderConfiguration.STANDARD_BITRATE, VideoEncoderConfiguration.ORIENTATION_MODE.ORIENTATION_MODE_FIXED_PORTRAIT));</pre><p>IRtcEngineEventHandler implements various callbacks that handle events related to the Agora SDK for real-time communication.</p><pre>private final IRtcEngineEventHandler mRtcEventHandler = new IRtcEngineEventHandler() {<br>    @Override<br>    public void onUserJoined(final int uid, int elapsed) {<br>        // Called when a remote user joins the channel<br>        runOnUiThread(() -&gt; {<br>            showShortMsg(&quot;User Joined&quot;);<br>            setupRemoteVideo(uid); // Set up remote video for the joined user<br>        });<br>    }<br><br>    @Override<br>    public void onUserOffline(final int uid, int reason) {<br>        // Called when a remote user leaves the channel or goes offline<br>        runOnUiThread(() -&gt; onRemoteUserLeft(uid));<br>    }<br><br>};</pre><p><strong>Remote User Interaction:</strong></p><pre>private SurfaceView mRemoteView;<br>private void setupRemoteVideo(int uid) {<br>    mRemoteView = RtcEngine.CreateRendererView(getBaseContext());<br>    mRemoteView.setZOrderMediaOverlay(true);<br>    container.addView(mRemoteView);<br>    mRtcEngine.setDefaultAudioRoutetoSpeakerphone(true);<br>    mRtcEngine.setupRemoteVideo(new VideoCanvas(mRemoteView, VideoCanvas.RENDER_MODE_HIDDEN, uid));<br>    mRemoteView.setTag(uid);<br>}</pre><p>The mRtcEngine.joinChannel() function initiates the user&#39;s connection to the Agora channel. It requires parameters such as the token (if applicable), channel name, optional data, and a unique user ID (UID) to identify the user within the channel.</p><pre>private void joinChannel() {<br>    // 1. Users can only see each other after they join the same channel successfully using the same app id.<br>    // 2. One token is only valid for the channel name that<br>    // you use to generate this token.<br>    String token = getString(R.string.agora_access_token);<br>    if (TextUtils.isEmpty(token) || TextUtils.equals(token, &quot;#YOUR ACCESS TOKEN#&quot;)) {<br>        token = null; // default, no token<br>    }<br>    mRtcEngine.joinChannel(token, &quot;channel_name&quot;, &quot;Extra Optional Data&quot;, 0);<br><br>}</pre><p><strong>Initializing the USB Camera:<br></strong>To incorporate the USB camera functionality into your app, you’ll need the following dependency:</p><pre>implementation &#39;com.github.jiangdongguo:AndroidUSBCamera:2.3.4&#39;</pre><p>This dependency provides access to the Android USB Camera library by jiangdongguo, allowing your application to communicate with and utilize USB cameras connected to Android devices.</p><pre>private void initUSBCamera() {<br>        mUVCCameraView = (CameraViewInterface) findViewById(R.id.camera_view);<br>        mUVCCameraView.setCallback(this);<br>        mCameraHelper = UVCCameraHelper.getInstance();<br>        mCameraHelper.setDefaultFrameFormat(UVCCamera.FRAME_FORMAT_YUYV);<br>        mCameraHelper.initUSBMonitor(this, mUVCCameraView, listener);<br>        mCameraHelper.setOnPreviewFrameListener(nv21Yuv -&gt; {<br>            int width = mCameraHelper.getPreviewWidth();<br>            int height = mCameraHelper.getPreviewHeight();<br>            // Check if the dimensions are valid<br>            if (width &gt; 0 &amp;&amp; height &gt; 0) {<br>                AgoraVideoFrame videoFrame = new AgoraVideoFrame();<br>                videoFrame.format = AgoraVideoFrame.FORMAT_NV21;<br>                videoFrame.stride = width;<br>                videoFrame.height = height;<br>                videoFrame.textureID = 2;<br>                videoFrame.timeStamp = System.currentTimeMillis(); // Set the timestamp<br>                videoFrame.buf = nv21Yuv;<br>                // Check if the RTC engine is initialized before pushing the frame<br>                if (mRtcEngine != null) {<br>                    mRtcEngine.pushExternalVideoFrame(videoFrame);<br>                }<br>            } else {<br>                Log.e(&quot;CameraHelper&quot;, &quot;Invalid preview dimensions&quot;);<br>            }<br>        });<br>        mRtcEngine.setExternalVideoSource(true, false, true);<br>    }</pre><p>The UVCCameraHelper.OnMyDevConnectListener is an interface used in the context of managing USB camera device connections and state changes within your Android application. It handles events related to USB device attachment, detachment, connection, and disconnection</p><pre>private UVCCameraHelper.OnMyDevConnectListener listener = new UVCCameraHelper.OnMyDevConnectListener() {<br>    @Override<br>    public void onAttachDev(UsbDevice device) {<br>        // request open permission<br>        if (!isRequest) {<br>            isRequest = true;<br>            if (mCameraHelper != null) {<br>                mCameraHelper.requestPermission(0);<br>            }<br>        }<br>    }<br><br>    @Override<br>    public void onDettachDev(UsbDevice device) {<br>        // close camera<br>        if (isRequest) {<br>            isRequest = false;<br>            mCameraHelper.closeCamera();<br>            showShortMsg(device.getDeviceName() + &quot; is out&quot;);<br>        }<br>    }<br><br>    @Override<br>    public void onConnectDev(UsbDevice device, boolean isConnected) {<br>        if (!isConnected) {<br>            showShortMsg(&quot;fail to connect,please check resolution params&quot;);<br>            isPreview = false;<br>        } else {<br>            isPreview = true;<br>            showShortMsg(&quot;connecting&quot;);<br>            // initialize seekbar<br>            // need to wait UVCCamera initialize over<br>            new Thread(() -&gt; {<br>                try {<br>                    Thread.sleep(2500);<br>                } catch (InterruptedException e) {<br>                    e.printStackTrace();<br>                }<br>                Looper.prepare();<br>                if (mCameraHelper != null &amp;&amp; mCameraHelper.isCameraOpened()) {<br>                    mSeekBrightness.setProgress(mCameraHelper.getModelValue(UVCCameraHelper.MODE_BRIGHTNESS));<br>                    mSeekContrast.setProgress(mCameraHelper.getModelValue(UVCCameraHelper.MODE_CONTRAST));<br>                }<br>                Looper.loop();<br>            }).start();<br>        }<br>    }<br><br>    @Override<br>    public void onDisConnectDev(UsbDevice device) {<br>        showShortMsg(&quot;disconnecting&quot;);<br>    }<br>};</pre><h4>Conclusion</h4><p>Emphasizing the successful integration of a USB camera with the Agora SDK to enable high-quality video calls on Android devices.<br> <br><strong>THANK YOU</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f7bdf8806db" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simplify Flutter State Management with Riverpod]]></title>
            <link>https://medium.com/@sonawanedipak111/simplify-flutter-state-management-with-riverpod-d15a6e4bb40f?source=rss-4b69c85fef7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/d15a6e4bb40f</guid>
            <dc:creator><![CDATA[Dipak Sonawane]]></dc:creator>
            <pubDate>Tue, 18 Jul 2023 13:52:15 GMT</pubDate>
            <atom:updated>2023-07-18T13:52:15.753Z</atom:updated>
            <content:encoded><![CDATA[<p>State management is an essential aspect of building any Flutter application. As projects scale and complexity grows, choosing the right state management solution becomes crucial. In this blog post, we’ll explore Riverpod, a powerful state management library for Flutter, and demonstrate how it simplifies managing state with a real-world example. We’ll also discuss the key advantages of using Riverpod in your Flutter projects.</p><p><strong>What is Riverpod?</strong><br>Riverpod is a state management library for Flutter, created by Remi Rousselet. It builds on the foundation of the Provider package while introducing additional features and improvements. Riverpod revolves around providers, which serve as a single source of truth for your application’s state. It offers a more organized, maintainable, and scalable approach to handling state, making it a favorite among Flutter developers.</p><p><strong>Simplified State Management:</strong><br>Riverpod offers a more straightforward and intuitive approach to managing state in Flutter apps. By using providers and a reactive programming model, developers can easily handle complex state interactions without resorting to nested callbacks or complex event chains.</p><p><strong>Hierarchical Provider Scoping:<br></strong>Riverpod allows developers to organize providers in a hierarchical manner, mirroring the widget tree. This hierarchical provider scoping enables fine-grained control over the lifecycle of state and makes it easier to manage different parts of the app independently, promoting a modular and organized architecture.</p><p><strong>Automatic Dependency Resolution:<br></strong>Riverpod automatically handles the resolution of provider dependencies, which minimizes the need for manual injections and reduces boilerplate code. When a provider changes, Riverpod automatically updates only the parts of the UI that depend on it, leading to better performance and responsiveness.</p><p><strong>Async State Handling:<br></strong>Riverpod provides built-in support for handling asynchronous operations, such as futures and streams, with providers like FutureProvider and StreamProvider. This makes it seamless to manage async data flows, such as API requests and real-time updates, in a clean and organized manner.</p><p><strong>Immutable State and Unidirectional Data Flow:<br></strong>Riverpod encourages the use of immutable state, which helps prevent accidental state mutations and ensures a predictable and consistent application behavior. This aligns with the unidirectional data flow paradigm, simplifying debugging and maintaining a single source of truth for the app’s data.</p><p><strong>Smooth Migration from Provider:<br></strong>For developers familiar with the Provider package, Riverpod offers a seamless migration path. The similar design and philosophies between the two libraries make it easy to transition from Provider to Riverpod without significant code changes.</p><p>In summary, Riverpod is used in Flutter apps due to its ability to simplify state management, hierarchical provider scoping, automatic dependency resolution, built-in support for async state handling, and emphasis on testability and maintainability. With these advantages, Riverpod empowers developers to build scalable, maintainable, and efficient Flutter applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d15a6e4bb40f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GetX Vs BLOC Flutter]]></title>
            <link>https://medium.com/@sonawanedipak111/getx-vs-bloc-flutter-741e480bae67?source=rss-4b69c85fef7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/741e480bae67</guid>
            <dc:creator><![CDATA[Dipak Sonawane]]></dc:creator>
            <pubDate>Fri, 24 Feb 2023 15:54:07 GMT</pubDate>
            <atom:updated>2023-02-24T15:54:07.924Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/223/1*ssUoBhe0nWhRj8qrj63d-Q.png" /><figcaption>GetX on Pub Dev</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/218/1*4dtKS91ZLB8w4sHMpNtHOA.png" /><figcaption>Bloc on Pub Dev</figcaption></figure><p>Flutter has become one of the most popular frameworks for mobile app development due to its ease of use, flexibility, and performance. However, when it comes to state management, developers often face a tough choice between GetX and Bloc. Both frameworks are popular and have their own set of advantages and disadvantages. In this blog, we will compare GetX and Bloc and help you decide which one is best for your Flutter app development.</p><h3>What is GetX?</h3><p>GetX is a lightweight, reactive, and scalable state management solution for Flutter apps. It is a package that offers a range of features such as Dependency Injection (DI), Routing, State Management, and many more. GetX is a good choice for small, medium-sized and large applications because of its simplicity and ease of use. It is also known for its performance and speed.</p><h3>What is Bloc?</h3><p>Bloc stands for Business Logic Component and is a state management solution that follows the BLoC pattern. It provides a way to manage the application state by separating the business logic from the UI. Bloc is a powerful framework that offers a lot of features such as Stream management, Event handling, and State management. It is a good choice for large-scale applications that require complex state management.</p><h3>GetX vs. Bloc</h3><p>Now let’s compare GetX and Bloc based on different parameters.</p><h3>Architecture</h3><p>GetX follows the reactive programming approach, whereas Bloc follows the BLoC pattern. GetX is more straightforward and easier to implement compared to Bloc. On the other hand, Bloc is more complex but offers a higher level of abstraction and scalability.</p><h3>Performance</h3><p>GetX is known for its speed and performance because it uses fewer layers of abstraction compared to Bloc. GetX is also lightweight, making it faster to execute. <strong>Bloc, on the other hand, can be slower due to its many layers of abstraction</strong>.</p><h3>Learning Curve</h3><p><strong>GetX is easier to learn and implement compared to Bloc</strong> because it has fewer abstractions and <strong>requires less boilerplate code</strong>. With GetX, you can get started quickly, and it is less daunting for beginners. Bloc, on the other hand, has a steeper learning curve and requires more time to get used to.</p><h3>Community Support</h3><p>Both GetX and Bloc have an active community of developers, <strong>but GetX has gained more popularity recently. GetX has a larger community, making it easier to find resources, tutorials, and support</strong>. Bloc also has a good community, <strong>but it is not as large as GetX</strong>.</p><h3>Integration</h3><p>GetX offers a range of features such as <strong>Dependency Injection</strong>, <strong>Routing</strong>, <strong>and State management</strong>, making it easier to integrate with other packages. Bloc also offers a wide range of features, but it requires more setup and configuration to integrate with other packages.</p><h3>Use cases</h3><p>GetX is suitable for small, medium and large sized applications that require simple state management, while Bloc is suitable for large-scale applications that require <strong>complex state management</strong>. GetX is also a good choice for applications that require high performance and speed, while Bloc is suitable for applications that require high abstraction and scalability.</p><h3>Conclusion</h3><p>In conclusion,<strong> both GetX and Bloc are excellent state management solutions for Flutter app development</strong>. If you are developing a small, medium and large application and want a simple and fast solution also for a large scale application, GetX is a good choice. On the other hand, if you are developing a large-scale application that requires <strong>complex state management</strong> and <strong>abstraction</strong>, Bloc is a better choice. Ultimately, your choice depends on the requirements of your application and your personal preferences. We hope this comparison has helped you decide which one is best for your Flutter app development.</p><p>While the choice of state management solution ultimately depends on the specific needs and requirements of your Flutter application, personally, I would recommend GetX. It is a lightweight, scalable, and high-performance solution that offers a range of features, such as dependency injection, routing, and state management, making it a great choice for small, medium, and large-sized applications. However, it is important to evaluate all available options and choose the one that best fits your application’s unique needs.</p><p>If you are considering using GetX for your Flutter app development, you can find the package on Pub Dev, which is the official package repository for Dart and Flutter. GetX is a popular package with a large community of developers who have contributed to its development and maintenance, making it a reliable and well-supported solution.<br> It is always recommended to review the package documentation and community support before integrating any package into your project.</p><p>Thank you for reading…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=741e480bae67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Passing cookie and session storage values to an in-app webview in Flutter]]></title>
            <link>https://medium.com/@sonawanedipak111/passing-cookie-and-session-storage-values-to-an-in-app-webview-in-flutter-276cb19a2f7a?source=rss-4b69c85fef7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/276cb19a2f7a</guid>
            <category><![CDATA[webview]]></category>
            <category><![CDATA[inappwebview]]></category>
            <category><![CDATA[cookieandstorage]]></category>
            <category><![CDATA[flutter-webview]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Dipak Sonawane]]></dc:creator>
            <pubDate>Thu, 19 Jan 2023 04:47:29 GMT</pubDate>
            <atom:updated>2023-01-19T04:47:29.028Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*YcUPIwgRBGNRAK8AspXG6Q.png" /></figure><p>Hello everyone,<br>Flutter is a popular open-source framework for developing mobile apps that run on both iOS and Android. One of the powerful features of Flutter is its ability to embed web content within a mobile app using a widget called InAppWebView. In this blog post, we will take a look at how to use the InAppWebView widget in Flutter to embed web content within a mobile app.<br> It is common to encounter issues when trying to integrate websites into a Flutter app using in-app webviews. <br>However, with the right techniques and tools, it is possible to create a seamless and efficient user experience.</p><p>In addition to embedding web content within a mobile app, the InAppWebView widget in Flutter also allows for setting multiple cookies and session storage values, providing a more comprehensive and customizable experience for integrating web content within your app.</p><p>First, we need to add the flutter_inappwebview package to our pubspec.yaml file. This package provides the InAppWebView widget, which we will use to embed web content within our app. Once we have added the package, we can import it in our file and use it within our app.</p><p>Using the InAppWebView widget is simple. We can create an instance of the widget and pass it the URL of the web content we want to display. We can also specify various options such as the initial scale of the web content, whether to enable JavaScript, and whether to enable navigation controls.</p><pre>            ///Declare your cookiemanager<br>               CookieManager cookie = CookieManager.instance();<br>                     InAppWebView(<br>                      key: _key,<br>                      shouldOverrideUrlLoading:<br>                          (controller, navigationAction) async {<br>                        var uri = navigationAction.request.url;<br>                        return NavigationActionPolicy.ALLOW;<br>                      },<br>                      initialOptions: InAppWebViewGroupOptions(<br>                          ios: IOSInAppWebViewOptions(<br>                              sharedCookiesEnabled: true,<br>                              minimumZoomScale: 1.0,<br>                              maximumZoomScale: 1.0),<br>                          crossPlatform: InAppWebViewOptions(<br>                            javaScriptEnabled: true,<br>                            supportZoom: false,<br>                          )),<br>                      initialUrlRequest: URLRequest(url: Uri.parse(yourUrl)),<br>                      onWebViewCreated:<br>                          (InAppWebViewController webViewController) async {<br>                        _webViewController = webViewController;<br>                        _controllerCompleter.future<br>                            .then((value) =&gt; _webViewController = value);<br>                        _controllerCompleter.complete(webViewController);<br><br>                      },<br>                      onLoadStart: (controller, url) async {<br>                        print(&quot;started to load: $url&quot;);<br>                        setState(() {<br>                          this.url = url.toString();<br>                        });<br>                      },<br>                      onLoadStop: (controller, url) async {<br>                        setState(() {<br>                          this.url = url.toString();<br>                          isLoading = false;<br>                         //you can set multiple cookie<br>                          await cookie.setCookie(<br>                          url: Uri.parse(&#39;yourUrl&#39;) ,<br>                          name: &#39;cookie name&#39;,<br>                          value: &#39;value&#39;,<br>                        );<br>                      //here we can set session storage value to webview if required<br>                    controller.webStorage.sessionStorage<br>                              .setItem(<br>                               key: &#39;session storage key&#39;,<br>                               value: &#39;value&#39;);<br><br><br>                        });<br>                      },<br>                      onProgressChanged:<br>                          (InAppWebViewController controller, int progress) {<br>                        setState(() {<br>                          this.progress = progress / 100;<br>                          if (progress == 100) {<br>                            print(&quot;progress&quot;);<br>                            loadingContainerHeight = 0;<br>                          }<br>                        });<br>                      },<br>                    ),<br></pre><p>We can also listen to various events, such as the start and stop of the loading process and the progress of the loading process, to provide feedback to the user.<br>In summary, the InAppWebView widget in Flutter is a powerful tool for embedding web content within a mobile app. It is easy to use, and provides a lot of flexibility in terms of customization and event handling. With this widget, you can provide a seamless experience to your users by integrating web content within your mobile app.</p><p>Thank you for taking the time to read my blog on using the InAppWebView widget in Flutter. We hope you found it informative and helpful in understanding how to integrate web content within your mobile apps. If you have any further questions or comments, please feel free to reach out to us. Thank you again for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=276cb19a2f7a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IgnorePointer & AbsorbPointer In Flutter.]]></title>
            <link>https://medium.com/@sonawanedipak111/ignorepointer-absorbpointer-in-flutter-355e8027159c?source=rss-4b69c85fef7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/355e8027159c</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[ignorepointer]]></category>
            <category><![CDATA[absorbpointer]]></category>
            <category><![CDATA[clickables]]></category>
            <category><![CDATA[dart]]></category>
            <dc:creator><![CDATA[Dipak Sonawane]]></dc:creator>
            <pubDate>Wed, 01 Dec 2021 15:23:09 GMT</pubDate>
            <atom:updated>2021-12-01T15:23:09.291Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*BlPeqDXBwlGmrDASziI47A.gif" /></figure><p>Every day we are learning new widgets from flutter but today we will learn two similar widgets with their properties and difference.<br>If you don’t want to make touchable widgets or non clickable widget then you can use<strong><em>IgnorePointer</em></strong> or <strong><em>AbsorbPointer </em></strong>widgets<em>.</em></p><p>In flutter normally if you want to non-clickable button then we will pass null in onPressed method. Let’s say if you want to disable click from your child widget then you can wrap widget using <strong><em>IgnorePointer</em></strong> or <strong><em>AbsorbPointer.</em></strong></p><p>First we will see <strong><em>IgnorePointer Property:</em></strong></p><pre>IgnorePointer(<br>  ignoring: ignoring,<br>  child:Column(<br>  children: &lt;Widget&gt;[<br>    RaisedButton(<br>      child: Text(&#39;Press&#39;),<br>      onPressed: () {<br>        Scaffold.<em>of</em>(context).showSnackBar(<br>            SnackBar(content: Text(&#39;You clicked button&#39;)));<br>      },<br>    ),<br>    TextField(),<br>  ],<br>),<br>);</pre><p>The above example shows how we can wrap and disable child widget using IgnorePointer.<br><strong><em>AbsorbPointer</em> is also act like </strong><strong><em>IgnorePointer </em></strong>following example states the use of <strong><em>AbsorbPointer.</em></strong></p><pre> AbsorbPointer(<br>   absorbing: ignoring,<br>   child: Column(<br>     children: &lt;Widget&gt;[<br>       RaisedButton(<br>         child: Text(&#39;Press&#39;),<br>         onPressed: () {<br>           Scaffold.<em>of</em>(context).showSnackBar(<br>               SnackBar(content: Text(&#39;You clicked button&#39;))<br>           );<br>         },<br>       ),<br>       TextField(),<br>     ],<br>   ),<br> ),</pre><p>So, We have seen use of both widgets but if this works similarly then why we need two widgets then here is the main difference between <strong><em>IgnorePointer</em></strong> and <strong><em>AbsorbPointer.</em></strong></p><p>When there is stack widget and in that you are using two buttons or widget with exactly same position.Button 2 is above Button 1. Button2 is wrapped inside IgnorePointer. When a button is clicked, a click action performed.</p><pre>Stack(<br>    alignment: AlignmentDirectional.<em>center</em>,<br>    children: [<br>       ElevatedButton(<br>        onPressed: () {<br>          print(&#39;Button A is pressed&#39;);<br>        },<br>        child: Text(&#39;Click Here&#39;),<br>      ),<br>      IgnorePointer(<br>        ignoring: ignoring,<br>        child:  ElevatedButton(<br>        onPressed: () {<br>          print(&#39;Button B is pressed&#39;);<br>        },<br>        child: Text(&#39;Click Here&#39;),<br>        ),<br>      ),<br>    ]),</pre><p>If ignoring property is set to true and you click on the button, you will see the <strong>Button A is pressed</strong> from Button A. It means the pointer is ignored on Button B, but the pointer is detected on Button A.</p><p>Same widget if we wrap using AbsorbPointer then absorbing is set to true and you try to click on the button, neither Button A nor Button B will not perform click action. That means the pointer is absorbed and not touching to the layers below AbsorbPointer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2SpSEM0lOOhjhrZ6Gx8snA.png" /></figure><pre>Stack(<br>    alignment: AlignmentDirectional.<em>center</em>,<br>    children: [<br>      ElevatedButton(<br>        onPressed: () {<br>          print(&#39;Button A is pressed&#39;);<br>        },<br>        child: Text(&#39;Click Here&#39;),<br>      ),<br>      AbsorbPointer(<br>        absorbing: _absorbing,<br>        child: ElevatedButton(<br>          onPressed: () {<br>            print(&#39;Button B is pressed&#39;);<br>          },<br>          child: Text(&#39;Click Here&#39;),<br>        ),<br>      ),<br>    ])</pre><p>T hank you for reading.</p><p>Stay tuned for next article..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*TRSzk4liGTQwyRdAkzf0sA.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=355e8027159c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lint Rules for Flutter]]></title>
            <link>https://medium.com/@sonawanedipak111/lint-rules-for-flutter-1567a25ade8b?source=rss-4b69c85fef7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/1567a25ade8b</guid>
            <category><![CDATA[rules]]></category>
            <category><![CDATA[lint]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[linter]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Dipak Sonawane]]></dc:creator>
            <pubDate>Mon, 04 Oct 2021 08:38:10 GMT</pubDate>
            <atom:updated>2021-10-04T08:38:10.012Z</atom:updated>
            <content:encoded><![CDATA[<p>In Previous post we have learn how to use Getx in flutter. Today we will learn how to set Lint rules in flutter. It’s very important for production release. <br>It improve application performance and coding standard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*MmLp2x6cMbr27HdRI9OSTg.gif" /></figure><p>As we all are humans so we write code as per our understanding, but we don’t follow coding rules we just know the my life, my rules, but when it comes about coding then language having also their coding rules.</p><p>So Let’s get started with setting up the lint rules for flutter.</p><p><strong>What is Lint?</strong></p><p><strong>Lint</strong> always watch your source code and gives warning and error related to programatically and style error. It gives power to write a code like a king.<br>As we are coder then unfortunately will make some identical and non-identical mistakes during programming. To avoid this problem lint is important at the time of application development. Lint is like quality checker for your source code.<br>There are multiple rule defined in lint like setting up the single quotes and double quotes, class constructor , Ordering in parameter for json response etc.</p><p><strong>Specify Annotation to parameter<br></strong>When we are using function and passing dynamic parameter in constructor always specify data type in function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uVt7U5Xh0v8OEd0MQmKSJQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*GHafBioc-Rac4XqeyMEkOw.gif" /></figure><p><strong>AVOID lines longer than 80 characters<br></strong>Long lines of text are harder to read because your eye has to “more distant” when moving to the beginning of the next line. This is why newspapers and magazines use multiple columns of text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u6zBJ5DTyBPP1FTzENKM5w.png" /></figure><p><strong>Missing white space between adjacent string.<br></strong>With long text split across adjacent strings it’s easy to forget a whitespace between strings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0IeUfjGg1-C_tsaSaAZqWg.png" /></figure><p><strong>How to set up lint in Flutter<br></strong>It’s usually well to set up lint rules at the beginning of a project rather than after mid or completion of a project since the warnings to be fixed might increase.</p><p>Rules are Divided into 3 groups:</p><ul><li><strong>Error rules</strong> -These are regarding common mistakes that occur during coding.</li><li><strong>Style rules - Dart Style Guide </strong>stated by dart like Identifiers, lowerCamelCase, upperCamelCase etc<strong>.</strong></li><li><strong>Pub- </strong>Pub file related error.</li></ul><p><strong>Specify individual rules in lint<br></strong>If you want to enable or disable any rule you can set it into analysis_options.yaml file.</p><pre>include: package:lint/analysis_options.yaml<br><br>linter:<br>  rules:<br>    <em># Make constructors the first thing in every class</em><br>    sort_constructors_first: true<br><br>    <em># The new tabs vs. spaces. Choose wisely</em><br>    prefer_single_quotes: true<br>    prefer_double_quotes: true<br><br>    <em># Good packages document everything</em><br>    public_member_api_docs: true<br><br>    <em># Blindly follow the Flutter code style, which prefers types everywhere</em><br>    always_specify_types: true</pre><pre>    <em># Back to the 80s</em><br>    lines_longer_than_80_chars: true<br><br>    <em># Use parameter order as in json response</em><br>    always_put_required_named_parameters_first: false<br><br>    <em># Util classes are awesome!</em><br>    avoid_classes_with_only_static_members: false</pre><p><a href="https://pub.dev/packages/lint">lint | Dart Package</a></p><p>After that create analysis_options.yaml file in the same directory as the <strong>pubspec.yaml</strong> file and define lint rules in this file.</p><p>That’s all about rules for lint in flutter. Don’t forget to add lint in flutter application before starting development.<br>Thanks for reading and stay tuned for next article…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*lBdGxiro9pPethLC2sIGXQ.gif" /><figcaption><strong>Thanks for reading and stay tuned for next article…</strong></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1567a25ade8b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Using GetX State Management.]]></title>
            <link>https://medium.com/@sonawanedipak111/flutter-using-getx-state-management-e420428d8d78?source=rss-4b69c85fef7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e420428d8d78</guid>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[getx]]></category>
            <category><![CDATA[state-management]]></category>
            <category><![CDATA[flutter-getx]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Dipak Sonawane]]></dc:creator>
            <pubDate>Thu, 30 Sep 2021 18:52:38 GMT</pubDate>
            <atom:updated>2021-09-30T18:53:34.530Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GwFqblwcT9qW9hZifmynQw.png" /></figure><p>When we are developing complex or simple application using dart the first thing is important to manage the state management to make application robust and stable.</p><p>GetX is the most use-full approach to manage the state in application.</p><p>It’s very easy to use and manage.It provides many tools such as Get.utils , GetPlatform , current routing etc.<br>Do not call a dispose method inside GetxController, it will not do anything, remember that the controller is not a Widget, you should not “dispose” it,<br>and it will be automatically and intelligently removed from memory by Get. If you use any stream on it and want to close it, just insert it into the onClose method.</p><blockquote><strong>Following methods are used to manage GetX state:</strong><br>Getx();<br>Obx();<br>GetBuilder();</blockquote><p><strong>GetX()<br></strong>It Listens to observable (obs) changes.We can initialize controller itself using init:. <br>Safe to use init: if Controller already instantiated. Will connect to existing instance.</p><pre>GetX&lt;HomeController&gt;(<br>     init: HomeController(),<br>     builder: (controller) =&gt; Text(&#39;GetX: ${controller.data}&#39;),<br>                    ),</pre><pre>class HomeController extends GetxController {<br>  RxInt data= 0.obs;<br><br>  void change() =&gt; data.value++;<br>}</pre><p><strong>Obx() <br></strong>Obx is the most efficient way to implement when you have a very specific widget that you want to refresh as the value assigned changes .</p><ul><li>To use Obx a Rx value has to be implemented inside it .</li><li>It automatically detects the updation of Rx value inside it and refreshes only those specific elements inside the wrap.</li><li>Obx consumes even less ram than GetBuilder.</li><li>Obx can be used with multiple controller values passed in it .</li><li>update() does not work with Obx</li></ul><pre>class Demo extends StatelessWidget {<br>  @override<br>  Widget build(BuildContext context) {<br>    HomeController controller = Get.put(HomeController());<br><br>    return Scaffold(<br>      body: SafeArea(<br>        child: Center(<br>          child: Column(<br>            mainAxisAlignment: MainAxisAlignment.spaceEvenly,<br>            children: [</pre><pre>             Obx(() =&gt; Text(&#39;Obx: $controller.data}&#39;)<br>              ),<br>            ],<br>          ),<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><p><strong>GetBuilder()<br></strong>It’s similar to how setState() or notifyListener() works .</p><ul><li>GetBuilder has the property “initState”, just like StatefulWidget, and you can call events from your controller, directly from it, no more events being placed in your initState.</li><li>It’s a useful widget when you want to refresh the entire screen , when there have to be multiple widget refreshes at the same time.</li><li>In GetBuilder you only update the wrapped widgets inside the builder that’s why the performance is better as you have more control over rendered elements.</li><li>We use the ‘update()’ function to update the elements in getBuilder wrap.</li><li>We save a lot of ram using it as only specific elements are stateful and the application remains stateless.</li></ul><pre>class Demo extends StatefulWidget {<br>  const Demo({Key key}) : super(key: key);<br><br>  @override<br>  _DemoState createState() =&gt; _DemoState();<br>}<br>class _DemoState extends State&lt;Demo&gt; {<br> Widget build(BuildContext context) {<br>    return Scaffold(<br>      body: SafeArea(<br>        child: Center(<br>          child:  GetBuilder&lt;HomeController&gt;(<br>            builder: (_c){<br>              return Column(<br>                  mainAxisAlignment: MainAxisAlignment.spaceEvenly,<br>                  children: [<br>              Text(&#39;GetBuilder:   ${_c.value}&#39;),<br>              RaisedButton(<br>              child: Text(&#39;Call GetBuilder Function&#39;),<br>              onPressed: (){_c.updateValue();},<br>              ),<br>            ],<br>          );<br>  }<br>        ),<br>      ),<br>    )<br>    );<br>  }<br>}</pre><pre>class HomeController extends GetxController {<br> int data=0;<br><br>void updateValue(){<br>   data++;  <br>   update();}<br>}</pre><pre>}</pre><p><strong>Bindings of GetX controller</strong></p><p>There are two ways to initialise the controller in GetX.<br><strong>Get.put:<br></strong><em>keeps the Instance in memory and persist it. it can be used directly</em></p><p><strong>Get.lazyPut<br></strong><em>Lazyput is used to initiated only when is used.Instance will removed from memory automatically.</em></p><pre>class HomeControllerBinding extends Bindings {<br>  @override<br>  void dependencies() {</pre><pre>    Get.lazyPut&lt;HomeController&gt;(<br>      () =&gt; HomeController(Get.find()))</pre><pre>     Get.put&lt;HomeController2&gt;(HomeController2())<br>}<br>}</pre><p><strong>GetX Controller Bindings<br></strong>The Getx Binding class is called when a route is called, Using initialBinding in GetMaterialApp you can add all the dependencies that will be created.</p><pre>class Pages {<br>  static final <em>all </em>= [<br>    GetPage(<br>      name: AppRoutes.<em>home</em>,<br>      page: () =&gt; HomePage(),<br>      binding: HomeController(),<br>    ),</pre><pre>//multiple bindings in same route<br>  GetPage(<br>      name: AppRoutes.<em>home</em>,<br>      page: () =&gt; HomePage(),<br>      bindings: [HomeController(),HomeController1()],<br>    ),</pre><pre>}</pre><pre>abstract class Routes {<br>  static const <em>home </em>= &#39;/home-page&#39;;<br>}</pre><p><strong>GetX Routing<br></strong>To navigate from one screen to another screen we can use following navigations methods in GetX.</p><p><em>Get.to(Routes.home);<br>Get.off(Routes.home)<br>Get.back();<br>Get.offAllNamed(Routes.home);<br>Get.offAndToNamed(Routes.home);</em></p><p><strong>SnackBar Using Getx.<br></strong>If we want to use snackbar then we need context to overcome this problems GetX introduce it’s own snackbar without using context.</p><pre>Get.snackbar(&quot;Exception&quot;, &quot;Login Failed&quot;,<br>    snackPosition: SnackPosition.BOTTOM,<br>    backgroundColor: Colors.<em>black</em>,<br>    colorText: Colors.<em>white</em>);</pre><p><strong>Thanks for Reading!!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e420428d8d78" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>