<?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>Forem: Vinamra Singh</title>
    <description>The latest articles on Forem by Vinamra Singh (@vinamra_singh).</description>
    <link>https://forem.com/vinamra_singh</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%2F929332%2Fc89b210f-3090-41c2-b2ea-6eb3a6ebd7e2.png</url>
      <title>Forem: Vinamra Singh</title>
      <link>https://forem.com/vinamra_singh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/vinamra_singh"/>
    <language>en</language>
    <item>
      <title>Top 10+ Flutter Tips, Tricks, and Techniques</title>
      <dc:creator>Vinamra Singh</dc:creator>
      <pubDate>Mon, 26 Sep 2022 11:19:35 +0000</pubDate>
      <link>https://forem.com/quokkalabs/top-10-flutter-tips-tricks-and-techniques-2ik9</link>
      <guid>https://forem.com/quokkalabs/top-10-flutter-tips-tricks-and-techniques-2ik9</guid>
      <description>&lt;p&gt;Flutter is an excellent framework for building iOS and Android Apps. Developers are engaged in its single codebase system utility for cross-platform application development. Learn the essential steps and tricks to become a pro in flutter application development.&lt;/p&gt;

&lt;h2&gt;
  
  
  Follow These 10+ Initial Steps To Learn Flutter
&lt;/h2&gt;

&lt;p&gt;To start with Flutter application development, one should be familiar with the Dart language, syntax, and the proper workflow.&lt;/p&gt;

&lt;p&gt;Follow the essential things if anyone wants to step ahead with &lt;a href="https://quokkalabs.com/blog/future-of-flutter-in-2022-beyond/"&gt;Flutter App development&lt;/a&gt;. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First, learn Dart language programming fundamentals.&lt;/li&gt;
&lt;li&gt;Get familiar with VSCode IDE, Android Studio, and IntelliJ.&lt;/li&gt;
&lt;li&gt;Then Learn Widgets(Inherited, Stateless, Stateful), Assets(Fonts, images, Audio, Video).&lt;/li&gt;
&lt;li&gt;Rememeber Plugins and Packages- package_info, dio, http, font_awesome_flutter, cached_network_image, url_launcher, json_serialization, camera, etc.&lt;/li&gt;
&lt;li&gt;Learn Animation basics: Opacity, Hero, Transform, AnimatedController, AnmatedBuilder, FadeInImage, CurvedAnimation.&lt;/li&gt;
&lt;li&gt;Learn Navigation essentials: Transitions&lt;/li&gt;
&lt;li&gt;Practice on Database: SQFlite shared preferences&lt;/li&gt;
&lt;li&gt;Learn Firebase Essentials: Firebase Database, Firebase Messaging, Firebase Auth, Firebase Storage.&lt;/li&gt;
&lt;li&gt;Learn State Management Basics: GETX, Redux, BLoC, Providers+ScopedModel, setState, MobX, provider&lt;/li&gt;
&lt;li&gt;Learn QA Basics: A/B Testing, UserBehaviour Analytics, GooglePlay Beta tests, AppCenter. Also, QA Firebase-Analytics, App distribution, Crashlytics.&lt;/li&gt;
&lt;li&gt;Learn Native Integration for iOS: Swift/Obj-C, AppStore, AppleCertf, x-Code, &amp;amp; for Android: Google PlayStore, Java/ Kotlin, Android Studio, App Signing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Top10+ Amazing Tips &amp;amp; Tricks To Get Efficient With Flutter
&lt;/h2&gt;

&lt;p&gt;We must research on the web and other platforms and curate tips and tricks to enhance your flutter development knowledge and skills. Read the blog till the end and learn the advanced things and shortcuts.&lt;/p&gt;

&lt;h3&gt;
  
  
  1.PDF file load
&lt;/h3&gt;

&lt;p&gt;You can load files from three types: assets, URL, and file.&lt;br&gt;
First, you need to use dependency advance_pdf_viewer to pubspec.yaml&lt;br&gt;
&lt;code&gt;Advance_pdf_viewer: any&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Invoke loadPdf() inside initState()&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;import 'package:flutter/material.dart';
import 'package:advance_pdf_viewer/advance_pdf_viewer.dart';
void main() =&amp;gt; runApp(MaterialApp(
      home: MyApp(),
    ));
class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() =&amp;gt; _MyAppState();
}
class _MyAppState extends State&amp;lt;MyApp&amp;gt; {
  bool _isLoading = true;
  late PDFDocument document;
  @override
  void initState() {
    super.initState();
    loadDocument();
  }
  loadDocument() async {
    document = await PDFDocument.fromAsset('assets/sample.pdf');
    setState(() =&amp;gt; _isLoading = false);
  }
  changePDF(value) async {
    setState(() =&amp;gt; _isLoading = true);
    if (value == 1) {
      document = await PDFDocument.fromAsset('assets/sample2.pdf');
    } else if (value == 2) {
      document = await PDFDocument.fromURL(
        "https://unec.edu.az/application/uploads/2014/12/pdf-sample.pdf",
      );
    } else {
      document = await PDFDocument.fromAsset('assets/sample.pdf');
    }
    setState(() =&amp;gt; _isLoading = false);
    Navigator.pop(context);
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      drawer: Drawer(
        child: SizedBox(
          height: 36,
          child: ListTile(
            title: const Text('Load from URL'),
            onTap: () {
              changePDF(2);
            },
          ),
        ),
      ),
      appBar: AppBar(
        title: const Text('FlutterPluginPDFViewer'),
      ),
      body: Center(
        child: _isLoading
            ? const Center(child: CircularProgressIndicator())
            : PDFViewer(
                document: document,
                zoomSteps: 1,
              ),
      ),
    );
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2.Generate files with automation
&lt;/h3&gt;

&lt;p&gt;You come from an IT and tech background; we look for the resources, tips, and short tricks to get our work done before the deadline. So, if you want to generate files faster, please install VS code extensions for flutter development.&lt;/p&gt;

&lt;h3&gt;
  
  
  3.Easy theme customization
&lt;/h3&gt;

&lt;p&gt;Want to make your widget appearance more appealing &amp;amp; attractive? Here is the code to modify a particular widget theme in the flutter application development project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Theme{
data:ThemeData(...)
child:TextFormField(
Decoration:const InputDecoration(
icon:Icon(Icons.person),
hintText:’type message here’,
labelText:’message*’,
),
validator:(value){
Return value!.contains(‘@’)?
‘Do not use the @ char’:null;
} 
debugPrint()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4.Access huge of data without any issue
&lt;/h3&gt;

&lt;p&gt;In general, we use print() to display data. But sometimes, the system console is unable to present the complete view. We have an alternative to accessing or printing huge lines of data. Use &lt;br&gt;
&lt;code&gt;debugPrint()&lt;/code&gt; and get a detailed view.&lt;/p&gt;
&lt;h3&gt;
  
  
  5.Share files easily
&lt;/h3&gt;

&lt;p&gt;We all love to share fun content with our friends and family. Now you can enable this functionality to your flutter app and enhance the user experience. You just need to follow a few simple steps during flutter application development.&lt;br&gt;
Access pubspec.yaml&lt;/p&gt;

&lt;p&gt;Add the package dependency: share_plus like as follow&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Dependencies:&lt;br&gt;
share_plus:^4.0.10&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now import the package library as follow:&lt;br&gt;
Import &lt;code&gt;‘package:share_plus/ share_plus.dart’&lt;/code&gt;;&lt;/p&gt;

&lt;p&gt;Now next is calling the static share method anywhere in the code:&lt;br&gt;
&lt;code&gt;Share.share(&lt;br&gt;
‘Check out my website your website url’&lt;br&gt;
);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In case you are adding embedding this functionality for email, then follow the below code lines:&lt;br&gt;
&lt;code&gt;Share.share(&lt;br&gt;
‘Check out my website your website url’&lt;br&gt;
Subject: ‘type your suject ’,&lt;br&gt;
);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This static ShreFiles method function is accessible across all the available dart codes. You have permission to add text or subject.&lt;br&gt;
Do this as follow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Share.shareFiles(
[‘${directory.path}/image.jpg’],
Text: ‘Your text’,
);

Share.shareFiles(
[‘${directory.path}/image.jpg’,
‘${directory.path}/image.jpg’],
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  6.Modify Futter Launcher Icons
&lt;/h3&gt;

&lt;p&gt;Flutter offers all the basic and advanced accessibilities to do the tasks rapidly. But we don’t have any idea to modify or change flutter icons. However, now you can try this trick and break this sigma in flutter development.&lt;/p&gt;

&lt;p&gt;Before proceeding further, remember to use a 900x900 resolution image.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We need to design a background.png and foreground.png image. It will transform that into an adaptive icon. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://adapticon.mariusclaret.com/"&gt;https://adapticon.mariusclaret.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can visit the URL to validate the adaptive icon.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now create a single icon png.&lt;/li&gt;
&lt;li&gt;Go to assets/ launcher/  and put these 3 images here.&lt;/li&gt;
&lt;li&gt;Now access pubspec.yaml
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dev_dependencies:
flutter Launcher_icons: "^0.7.0"
flutter icons:
ios: true
android: true
image_path_ios: "assets/launcher/icon.png"
image_path_android: "assets/launcher/icon.png" 
adaptive_icon_background: "assets/launcher/background.png"
adaptive_icon_foreground: "assets/launcher/foreground.png";

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The last thing to do is command execution to get the output.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;flutter packages get&lt;br&gt;
&lt;code&gt;flutter packages pub run flutter _launcher_icons:main&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  7.Efficient Debugging with Performance Overlay
&lt;/h3&gt;

&lt;p&gt;You can check if the frame is suitable for easy rendering or not. You just have to mention showPerformanceOverlay, giving you output regarding the frame.&lt;/p&gt;

&lt;p&gt;Check the Raster thread or GPU time on top and Ui time at the bottom. If the GPU graph is evident in red color, it means the scene is too long to render or fit in the frame. Similarly, the dart code is unsuitable if the Ui thread/ graph also shows the bar status in the red. &lt;/p&gt;

&lt;p&gt;We use these tips as follows:&lt;br&gt;
&lt;code&gt;Return MaterialApp(&lt;br&gt;
showPerformanceOverlay: true;&lt;br&gt;
Title: CIT’,&lt;br&gt;
)&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  8.Access flashlight in Flutter application development
&lt;/h3&gt;

&lt;p&gt;Now you can access flashlight accessibility to your flutter apps with a few steps of dependency and package import.&lt;br&gt;
&lt;code&gt;dependencies:&lt;br&gt;
torch_light: ^0.4.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Below is the flutter development code you can embed into your application program:&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;Future&amp;lt;void&amp;gt; _turnOnFlash(BuildContext context) async {

try{
await Torch_Light.enableTorch(_);
} on Exception catch (_) {
_showErrorMes(‘Could not turn on flashlight’, context);
}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Future&amp;lt;void&amp;gt; _turnOffFlash(BuildContext context) async {

try{
await Torch_Light.disableTorch(_);
} on Exception catch (_) {
_showErrorMes(‘Could not turn on flashlight’, context);
}
}
void_showErrorMes(String mes, BuidContext context) {
ScaffoldMessenger.of(context)
.showSnackBar(Snackbar(Content: Text(mes)));
}
}

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  9.Detect Gestures easily
&lt;/h3&gt;

&lt;p&gt;Flutter allows you to detect gestures for every hand move:&lt;br&gt;
Use Tap for Single tap, further use double Tap, drag, zoom, press, LongPress, and more.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Container(
color:_color,
height: 200.0,
width: 200.0,
child: GestureDetector(
onTap: () =&amp;gt;
setState(() {_color = Colors.yellow;}),
),
 )

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  10.Pause Program Flow
&lt;/h3&gt;

&lt;p&gt;If you want to hold the process for a while in a program, then you can use Future.delayed() and type the duration to pause the program flow. It’s just 2 line code for flutter application development.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;await Future.delayed(&lt;br&gt;
Const Duration(seconds: type no.));&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  11.Add transition to any text
&lt;/h3&gt;

&lt;p&gt;Want to enhance the text in the app? Follow the below code:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;AnimatedDefaultTextStyle(&lt;br&gt;
Duration: Duration(milliseconds:300),&lt;br&gt;
Child: Text(“Flutter”),&lt;br&gt;
style:newStyle,&lt;br&gt;
)&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  12.Reduce app size
&lt;/h3&gt;

&lt;p&gt;Images are responsible for slowing down the app's performance. It increases the app size, so the best way is to access any hosting entity or services like firebase or any other.&lt;/p&gt;

&lt;p&gt;Alternatively, you should compress the image resolution and should not store them in the assets folder. It will smoothen the UI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Additional Tips for Flutter Application Development:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can reduce the CPU cycle for essential purposes through stateless widgets.&lt;/li&gt;
&lt;li&gt;Prevent the reconstruction of widgets by adding one single keyword, ' const’.&lt;/li&gt;
&lt;li&gt;Load your lists and grids slowly by adding ListView.builder.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Lets us know if you have tried these things earlier or found something exciting and new!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
