Showing posts with label Flutter. Show all posts

Wednesday, 30 June 2021

Flutter Tip : Included Only classes in the project instead of all dart classes.

  1 comment
11:28

We normally depend on the third-party libraries' APIs and this has happened with each programming language. 

So, In Flutter, For example, you want to check on which platform the application is running then for this need to import the dart:io library and Its lots of classes in its packages. But we need access to ProcessInfo.dart class methods only and to do this, We need to use the show keyword while importing the library.  It will only include this class and discard all other classes present in the library. Furthermore, you can check this link for a better understanding 


Method 1 : It will include all the classes present in the library. 

import 'dart:io';

Method 2: It will include only the classes which we need. 

import 'dart:io' show ProcessInfo;

Apart from the above, We also have other keywords as well and which are very helpful. 👍 Such as hide and as.

import 'dart:io' hide ProcessInfo; //It will hide ProcessInfo classe from the io package.

import 'dart:io' as AnyName; //It will rename the io package name to AnyName, Then you can access this packages classes method by using AnyName.(Enter method name)





Read More

Thursday, 24 June 2021

Sending Email Without Opening Third Parties Apps In Flutter

  No comments
11:51

Email is one of the oldest message sending techniques present today. The email was created in 1972 by Ray Tomlinson. So now you know a little bit about the history of the email, and if you want to know more about the history of the email please refer to this link

Now, Let's jump into the implementation and the very first thing you need to do is to download the mailer package 


Use this package as a library:

Run this command: 

With Dart:

 $ dart pub add a mailer

With Flutter:

 $ flutter pub add a mailer

This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):

dependencies:

  mailer: ^5.0.0

Now in your Dart code, you can use:

import 'package:mailer/mailer.dart';

After done with the above setup, add the below code and modified it according to your need. 


Note: You need to allow the less secure app access from your Gmail like as showing in the screenshot





Read More