<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: saurabh singh aswal</title>
    <description>The latest articles on DEV Community by saurabh singh aswal (@saurabhaswal009).</description>
    <link>https://dev.to/saurabhaswal009</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1119453%2F7d22c27a-e34f-4e2b-891c-0635961247b1.png</url>
      <title>DEV Community: saurabh singh aswal</title>
      <link>https://dev.to/saurabhaswal009</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/saurabhaswal009"/>
    <language>en</language>
    <item>
      <title>How to add App Rating in Flutter app</title>
      <dc:creator>saurabh singh aswal</dc:creator>
      <pubDate>Sat, 05 Aug 2023 07:02:38 +0000</pubDate>
      <link>https://dev.to/saurabhaswal009/how-to-add-app-rating-in-flutter-app-3144</link>
      <guid>https://dev.to/saurabhaswal009/how-to-add-app-rating-in-flutter-app-3144</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--InWvoi2i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tqro3ljyhsi0rz1gfaxx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--InWvoi2i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tqro3ljyhsi0rz1gfaxx.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Adding an app rating feature to your app can bring several benefits, both for the app developers and the users. Here are some of the key advantages:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. User feedback and insights.&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;2. App visibility and credibility&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;3. User acquisition and retention&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;4. App store optimization (ASO)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iNhPEdzG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vpn1x2zh3j9gg3nz657s.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iNhPEdzG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vpn1x2zh3j9gg3nz657s.gif" alt="Image description" width="150" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Create a new Flutter project (if you don’t already have one)&lt;/strong&gt;&lt;br&gt;
If you don’t have a Flutter project, create one using the following command in your terminal or command prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flutter create your_project_name
cd your_project_name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2: Open the project in your preferred code editor&lt;/strong&gt;&lt;br&gt;
Open your newly created Flutter project in your code editor. You can use editors like Visual Studio Code, Android Studio, or IntelliJ IDEA. i am using Android Studio.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Update pubspec.yaml&lt;/strong&gt;&lt;br&gt;
The pubspec.yaml file is where you declare the dependencies for your Flutter project. Open the pubspec.yaml file and add the rating_dialog dependency to it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dependencies:
  flutter:
    sdk: flutter
  rating_dialog: ^2.0.4
  url_launcher: ^6.1.12
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4: Use the rating_dialog in your code&lt;/strong&gt;&lt;br&gt;
Now, you can use the RatingDialog widget to show the rating dialog in your app. For example, let’s show the rating dialog when a button is pressed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:flutter/material.dart';
import 'package:rating_dialog/rating_dialog.dart';
import 'package:url_launcher/url_launcher.dart';

final String url = "http://play.google.com/store/apps/details?id=";
final String packageName = "com.rateuse";

void main() {
  runApp(const App());
}

class App extends StatefulWidget {
  const App({super.key});

  @override
  State&amp;lt;App&amp;gt; createState() =&amp;gt; _AppState();
}

class _AppState extends State&amp;lt;App&amp;gt; {

  @override
  Widget build(BuildContext context) {


    return MaterialApp(
      title: "App Rating",
      home: RateUs(),
    );
  }
}

class RateUs extends StatefulWidget {
  const RateUs({Key? key}) : super(key: key);

  @override
  State&amp;lt;RateUs&amp;gt; createState() =&amp;gt; _RateUsState();
}


class _RateUsState extends State&amp;lt;RateUs&amp;gt; {





  final _dialog = RatingDialog(
    initialRating: 1.0,
    // your app's name?
    title: Text(
      'Rating Dialog',
      textAlign: TextAlign.center,
      style: const TextStyle(
        fontSize: 25,
        fontWeight: FontWeight.bold,
      ),
    ),
    // encourage your user to leave a high rating?
    message: Text(
      'Tap a star to set your rating. Add more description here if you want.',
      textAlign: TextAlign.center,
      style: const TextStyle(fontSize: 15),
    ),
    // your app's logo?
    image:  const FlutterLogo(size: 100),
    submitButtonText: 'Submit',
    commentHint: 'Set your custom comment hint',
    onCancelled: () =&amp;gt; print('cancelled'),
    onSubmitted: (response) {
      print('rating: ${response.rating}, comment: ${response.comment}');

      // TODO: add your own logic
      if (response.rating &amp;lt; 3.0) {
        // send their comments to your email or anywhere you wish
        // ask the user to contact you instead of leaving a bad review
      } else {
        _launchUrl();
      }
    },
  );

  @override
  Widget build(BuildContext context) {
    return WillPopScope(
      onWillPop: () async =&amp;gt; false,
      child: Scaffold(
        appBar: AppBar(
          backgroundColor: Color(0xFFe91e63),
          title: Text('Rate Us',style: TextStyle(fontSize: 18,color: Colors.white,fontWeight: FontWeight.bold),),
          centerTitle: true,
        ),
        body: Center(
            child:  DecoratedBox(
                decoration: BoxDecoration(
                    gradient: LinearGradient(colors: [
                      Color(0xFFFF800B),
                      Colors.redAccent,
                      Color(0xFFCE1010),
                      //add more colors
                    ]),
                    borderRadius: BorderRadius.circular(5),
                    boxShadow: &amp;lt;BoxShadow&amp;gt;[
                      BoxShadow(
                          color: Color.fromRGBO(0, 0, 0, 0.57), //shadow for button
                          blurRadius: 5) //blur radius of shadow
                    ]
                ),
                child:ElevatedButton(
                    style: ElevatedButton.styleFrom(
                      primary: Colors.transparent,
                      onSurface: Colors.transparent,
                      shadowColor: Colors.transparent,
                      //make color or elevated button transparent
                    ),
                    onPressed: (){
                      showDialog(
                        context: context,
                        barrierDismissible: true, // set to false if you want to force a rating
                        builder: (context) =&amp;gt; _dialog,
                      );
                    },
                    child: Padding(
                      padding:EdgeInsets.only(
                        top: 5,
                        bottom: 5,
                      ),
                      child:Text("Give Us Rating",style: TextStyle(color: Colors.white),),
                    )
                )
            )
        ),
      ),
    );
  }

}


Future _launchUrl() async {
  final Uri _url = Uri.parse(url+packageName);
  if (!await launchUrl(_url)) {
    throw Exception('Could not launch $_url');
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you explore and go deeper into this topic so check out my new article on this topic which is explained briefly 👇👇👇&lt;br&gt;
&lt;a href="https://dosomthings.com/how-to-add-app-rating-in-flutter-app/"&gt;https://dosomthings.com/how-to-add-app-rating-in-flutter-app/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;br&gt;
In conclusion, by following the steps above, you have successfully added the “rating_dialog” package version 2.0.4 to your Flutter app. You can now use the RatingDialog widget to show a rating dialog and gather user feedback or ratings for your app. Remember to stay up-to-date with the package documentation and updates to utilize any new features or improvements that might have been introduced in newer versions.&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>android</category>
      <category>dart</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to download and save image to file in Flutter</title>
      <dc:creator>saurabh singh aswal</dc:creator>
      <pubDate>Fri, 14 Jul 2023 06:24:04 +0000</pubDate>
      <link>https://dev.to/saurabhaswal009/how-to-download-and-save-image-to-file-in-flutter-389h</link>
      <guid>https://dev.to/saurabhaswal009/how-to-download-and-save-image-to-file-in-flutter-389h</guid>
      <description>&lt;p&gt;“One of the simplest activities that any application can perform is saving an image that has been downloaded from the Internet in the filesystem“&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hXv0wz4Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cm0q1pvgnxxajjkq4a29.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hXv0wz4Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cm0q1pvgnxxajjkq4a29.gif" alt="Image description" width="150" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hi guyz i hope you all are well so in this article we learn how to save url image into our local device like phone. Beginning with the assumption that we already know the URL of an image, we will download it first before saving it in the gallery or to a specified location.&lt;/p&gt;

&lt;p&gt;don’t waste your time go to the code in to do this task we will use the following dependencies:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;- &lt;strong&gt;flutter_file_dialog.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;- &lt;strong&gt;path_provider.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;- &lt;strong&gt;http.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Create a basic layout:&lt;/strong&gt;&lt;br&gt;
Now we are going to create a very basic layout that displays an image from URL:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Qa06HKNv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/itrk0voyvx8uoc1ilcot.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Qa06HKNv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/itrk0voyvx8uoc1ilcot.png" alt="Image description" width="800" height="1644"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:flutter/material.dart';

void main() {
  runApp(const App());
}

class App extends StatelessWidget {
  const App({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Save image to disk',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MainScreen(),
    );
  }
}

class MainScreen extends StatelessWidget {
  static const _url = 'https://dosomthings.com/wp-content/uploads/2022/07/dc0a7e44e96647848177c8afd4bdabdd.png';

  const MainScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Save image to disk'),
        centerTitle: true,
        backgroundColor: Color(0xFFe91e63),
        actions: [
          IconButton(
            onPressed: () {
              // We will add this method later
            },
            icon: const Icon(Icons.save,color: Colors.white,),
          ),
        ],
      ),
      body: Center(
        child: Container(
          padding: const EdgeInsets.only(
            left: 24.0,
            right: 24.0,
          ),
          child: ClipRRect(
            borderRadius: BorderRadius.circular(30.0),
            child: Image.network(_url),
          ),
        ),
      ),
    );
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2: Give permission and set Configuration in android for Download and save image:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.saveimage"&amp;gt;
    &amp;lt;uses-permission android:name="android.permission.INTERNET"/&amp;gt;
    &amp;lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&amp;gt;
    &amp;lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&amp;gt;
   &amp;lt;application&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And we upgrade to versions compileSdkVersion &amp;amp; minSdkVersion like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;android {
    //HERE..
    compileSdkVersion 33

    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3: Download and save image from the URL to a file:&lt;/strong&gt;&lt;br&gt;
The last step is to save the image to disk copy and paste.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'dart:math';
import 'package:flutter/material.dart';
import 'dart:io';
import 'package:flutter_file_dialog/flutter_file_dialog.dart';
import 'package:http/http.dart' as http;
import 'package:path_provider/path_provider.dart';

void main() {
  runApp(const App());
}

class App extends StatelessWidget {
  const App({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Save image to disk',
      home: MainScreen(),
    );
  }
}

class MainScreen extends StatelessWidget {
  static const _url = 'https://dosomthings.com/wp-content/uploads/2023/07/How-to-download-and-save-image-to-file-in-FlutterDosomthings.com_-1024x576.png';
  var random = Random();


  Future&amp;lt;void&amp;gt; _saveImage(BuildContext context) async {
    final scaffoldMessenger = ScaffoldMessenger.of(context);
    late String message;

    try {
      // Download image
      final http.Response response = await http.get(
          Uri.parse(_url));

      // Get temporary directory
      final dir = await getTemporaryDirectory();

      // Create an image name
      var filename = '${dir.path}/SaveImage${random.nextInt(100)}.png';

      // Save to filesystem
      final file = File(filename);
      await file.writeAsBytes(response.bodyBytes);

      // Ask the user to save it
      final params = SaveFileDialogParams(sourceFilePath: file.path);
      final finalPath = await FlutterFileDialog.saveFile(params: params);

      if (finalPath != null) {
        message = 'Image saved to disk';
      }
    } catch (e) {
      message = e.toString();
      scaffoldMessenger.showSnackBar(SnackBar(
        content: Text(
          message,
          style:  TextStyle(
            fontSize: 12,
            color: Colors.white,
            fontWeight: FontWeight.bold,
          ),
        ),
        backgroundColor: Color(0xFFe91e63),
      ));
    }

    if (message != null) {

      scaffoldMessenger.showSnackBar(SnackBar(
        content: Text(
          message,
          style:  TextStyle(
            fontSize: 12,
            color: Colors.white,
            fontWeight: FontWeight.bold,
          ),
        ),
        backgroundColor: Color(0xFFe91e63),
      ));

    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Save image to disk'),
        centerTitle: true,
        backgroundColor: Color(0xFFe91e63),
        actions: [
          IconButton(
            onPressed: () {
              _saveImage(context);
            },
            icon: const Icon(Icons.save,color: Colors.white,),
          ),
        ],
      ),
      body: Center(
        child: Container(
          padding: const EdgeInsets.only(
            left: 24.0,
            right: 24.0,
          ),
          child: ClipRRect(
            borderRadius: BorderRadius.circular(30.0),
            child: Image.network(_url),
          ),
        ),
      ),
    );
  }
}



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--n3nrbsh_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/650vc72ygkwcvp9moo1z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--n3nrbsh_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/650vc72ygkwcvp9moo1z.png" alt="Image description" width="800" height="1644"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;br&gt;
In this article, we have learned how to download and save an image to a file in Flutter. By following these steps, you can incorporate image downloading and saving functionality into your Flutter applications, opening up possibilities for offline image viewing and user-driven image saving features. &lt;br&gt;
I hope now you understand how to download image. seriously you don’t believe when i don’t know how to download image then i try find the solution in many youtube channel and article but no one can explains briefly how to do this task. but finally i got. So now this is your turn do code and enjoy it.&lt;/p&gt;

&lt;p&gt;If you you stuck in any case or you go too deep &lt;strong&gt;in this topic&lt;/strong&gt; so you can checkout my new post in this topic 👇👇👇&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dosomthings.com/how-to-download-and-save-image-to-file-in-flutter/"&gt;&lt;strong&gt;How to download and save image to file in Flutter&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;❤️❤️ Thanks for reading this article ❤️❤️&lt;/p&gt;

&lt;p&gt;If I got something wrong? Let me know in the comments. I would love to improve 🥰🥰🥰.&lt;/p&gt;

&lt;p&gt;Clap 👏👏👏 If this article helps you.&lt;/p&gt;

&lt;p&gt;if you like our work so please follow us on this Dosomthings&lt;/p&gt;

&lt;p&gt;Our New and Attractive articles:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;StreamBuilder VS FutureBuilder:&lt;/strong&gt; &lt;a href="https://dosomthings.com/what-is-difference-between-streambuilder-and-futurebuilder-in-flutter/"&gt;Difference Between StreamBuilder and FutureBuilder In Flutter&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tinder swipe card:&lt;/strong&gt; &lt;a href="https://dosomthings.com/how-to-implement-tinder-swipe-card-in-a-flutter/"&gt;How to implement tinder swipe card in a flutter.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Time Delay in Flutter:&lt;/strong&gt; &lt;a href="https://dosomthings.com/how-to-run-code-after-time-delay-in-flutter-app/"&gt;How to Run Code After Time Delay in Flutter App.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>download</category>
      <category>image</category>
    </item>
    <item>
      <title>Hi I am new in here 😀😀😀</title>
      <dc:creator>saurabh singh aswal</dc:creator>
      <pubDate>Fri, 14 Jul 2023 06:08:39 +0000</pubDate>
      <link>https://dev.to/saurabhaswal009/hi-i-am-new-in-here-5acp</link>
      <guid>https://dev.to/saurabhaswal009/hi-i-am-new-in-here-5acp</guid>
      <description>&lt;p&gt;Hello everyone I am new in here and so excited to be the part of this dev world. i am atrected here because the good coding stuff, friendly community, healping each others in coding, learn somthings new.&lt;br&gt;
I am a Flutter Developer and created a lots of apps and placed in playstore now i am work in my Personal Project so all the community member please  help me if i am stuck in some conditions and i am also available for your help also.&lt;/p&gt;

&lt;p&gt;please check out my website and if you give some feedback so i am so happy --&amp;gt;&amp;gt;&lt;a href="http://dosomthings.com/"&gt;Dosomthings.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thank's and please connected ❤️❤️❤️&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
