Google search engine
Home Blog Page 175

Payment Gateway Testing with Test Cases In Flutter

0

Hi everyone! today we learn about Payment Gateway Testing with Test Cases In Flutter. Payment Gateway is a system for online purchases and transactions by users. A payment gateway system is an e-commerce application service that approves credit card payments for online purchases.

If you’re looking for the best Flutter app development company for your mobile application then feel free to contact us at — support@flutterdevs.com.


Table Of Contents::

Payment Gateway Testing

Types of Payment Gateway System

Testing Types for Payment DomainScrum Pillars

How to test the Payment Gateway Complete Checklist

Example Test Cases for Payment Gateway Testing

Things to consider before Buying the Gateway Package

Conclusion


Payment Gateway Testing:

Payment Gateway Testing is the testing of a Payment Gateway in a system for online purchases and transactions by the users. The purpose of payment gateway testing is to ensure the security, reliability, and performance of a payment gateway by encrypting and securing the payment details between user and merchant while providing a smooth payment experience.

A payment gateway system is an e-commerce application service that approves credit card payments for online purchases. Payment gateways safeguard credit card details by encrypting sensitive information like credit card numbers, account holder details, and so on. This information is passed safely between the customer and the merchant and vice versa.

Modern payment gateways also securely approve payments via debit cards, electronic bank transfers, cash cards, reward points, etc.

Types of Payment Gateway System:

Payment Gateway Knowledge is Important

  • Hosted Payment Gateway: Hosted payment gateway system directs customers away from an e-commerce site to a gateway link during the payment process. Once the payment is done, it will bring a customer back to an e-commerce site. 
    For such type of payment you don’t need a merchant id, an example of a hosted payment gateway are PayPal, Noche, and WorldPay.
  • Shared Payment Gateway: In a shared payment gateway, while processing payment customer is directed to the payment page and stays on the e-commerce site. 
    Once the payment detail is filled in, the payment process proceeds. Since it does not leave the e-commerce site while processing payment, this mode is easy and preferable, an example of a shared payment gateway is eWay, Stripe.

Testing Types for Payment Domain:

Testing for Payment Gateway should include

  • Functional Testing: It is the act of testing the base functionality of the payment gateway. It is to verify whether the application behaves in the same way as it is supposed to like handling orders, calculation, the addition of VAT as per the country, etc.
  • Integration: Test integration with your credit card service.
  • Performance: Identify various performance metrics like the highest possible number of users coming through gateways during a specific day and converting them to concurrent users
  • Security: You need to perform a deep security pass for Payment Gateway.

How to test the Payment Gateway Complete Checklist:

Before you begin testing –

  • Collect accurate test data for the dummy credit card number for the maestro, visa, master, etc.
  • Collect payment gateway information like Google Wallet, Paypal, or else
  • Collect payment gateway documents with error codes
  • Understand the session and parameters passed through the application and payment gateway
  • Understand and test the amount of related information passed through query string or variable or session
  • Along with the payment gateway language check the language of the application
  • Under the various payment gateway settings like currency format, subscriber data is collected.

Example Test Cases for Payment Gateway Testing:

Following are important Test Scenarios/Cases to check Payment Gateway

  1. During the payment process try to change the payment gateway language
  2. After successful payment, test all the necessary components, whether it is retrieved or not
  3. Check what happens if the payment gateway stops responding during the payment
  4. During the payment process check what happens if the session ends
  5. During the payment process check what happens in the backend
  6. Check what happens if the payment process fails
  7. Check the Database entries whether they store credit card details or not
  8. During the payment process check the error pages and security pages
  9. Check the settings of the pop-up blocker, and see what happens if a pop-up blocker is on and off
  10. Between payment gateway and application check buffer pages
  11. Check on successful payment, a success code is sent to the application and a confirmation page is shown to the user
  12. Verify whether the transaction processes immediately or the processing is handed to your bank
  13. After a successful transaction check if the payment gateway returns to your application
  14. Check all formats and messages when the successful payment process
  15. Unless you don’t have an authorization receipt from the payment gateway, goods should not be shipped
  16. Inform the owner of any transaction processed through e-mail. Encrypt the content of the mail
  17. Check the amount format with the currency format
  18. Check if each of the payment options is selectable
  19. Check if each listed payment option opens the respective payment option according to the specification
  20. Verify whether the payment gateway defaults to the desired debit/credit card option
  21. Verify the default option for debit card shows the card selection drop-down menu

Things to consider before Buying the Gateway Package:

  • If you have bought a shopping cart package, find out about its compatibility
  • If a shopping gateway package is due, ask the payment gateway provider for a list of supported applications
  • The gateway must offer Address Verification System Protection
  • Find out the types of transaction protection being offered
  • Check what types of debit or credit cards are accepted by your chosen payment gateway
  • Check the transaction fees levied by a payment gateway
  • Check whether the gateways collect the payment right on the form or directly to another page to complete the purchase

Conclusion:

A payment gateway must provide a seamless experience in the realm of online transactions, for which it must be tested. The main objective of the testing process is to ensure the security of a transaction by encrypting the details of the customer and the merchant.

❤ ❤ Thanks for reading this article ❤❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us:
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! For any flutter-related queries, you can connect with us on Facebook, GitHub, Twitter, and LinkedIn.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.

Related: What Is Test Environment for Software Testing In Flutter

Need expert help building your Flutter app? Talk to FlutterExperts for architecture, development, and consulting support.

Decoding Flutter Web challenges

0

Flutter is a popular framework for building modern, high-performance multi-platform applications. Developed by Google, Flutter is known for its fast, expressive, and flexible approach to building user interfaces. With Flutter, developers can create beautiful, interactive, and responsive web applications that work across a range of devices and browsers. However, like any new technology, Flutter for the web comes with its challenges. In this article, I’ll decode some of the challenges that developers may face when using Flutter for web development. I’ll also provide some tips and solutions for overcoming these challenges so that you can make the most out of this powerful framework. Whether you’re a seasoned web developer looking to learn more about Flutter, or a newcomer to the world of web development, this article will provide valuable insights into the challenges and rewards of using Flutter for the web.

If you’re looking for the best Flutter app development company for your mobile application then feel free to contact us at — support@flutterdevs.com.


Table of contents:

1. Customizing flutter web app initialization

2. Resource sharing restrictions?

3. Configure URL strategy

4. Plugins & Custom code in JS

5. Conclusion


Customizing flutter web app initialization

Flutter web uses _flutter.loader javascript API. This API can be used to display a loading indicator in CSS and prevent the app from loading based on a condition.

1. The initialization process is broken down into three steps.

  1. Fetches the main.dart.js script and initializes the service worker.
  2. Initializes Flutter’s web engine by downloading required resources such as assets, fonts, and CanvasKit.
  3. Prepares the DOM for your Flutter app and runs it.

https://gist.github.com/Aditsyal/45f003d0cc1ea4a908c95f96ffcac2a4

EntryPoint Initialization

The loadEntrypoint method has the following parameters which can be customized:

  1. entrypointUrl — This points to the URL of our Flutter app’s entrypoint which is defaulted to the main.dart.js file.
  2. serviceWorker — This sets the flutter_service_worker.js configuration file.
  3. serviceWorkerVersion — This takes the service worker version set by the build process in our index.html file.
  4. timeoutMillis — This points to the timeout value for the service worker loader which is defaulted to 4000ms.

Engine Initialization
By default, the Flutter engine is initialized using the initializeEngine() function but we can also call the autoStart() to start the app immediately with the default configuration.

https://gist.github.com/Aditsyal/b3524d851445bb06c1ff1d6c82cb1625

Using these you can customize your Flutter web app initialization to something like,

https://gist.github.com/Aditsyal/5322eee024a97e1c5803e4824a8b71a8

Resource sharing restrictions?

Have you ever come across a situation where your Flutter web app failed to load the images from the web or arbitrary sources on your desktop browsers? Let’s take a scenario, that your Flutter web app displays video thumbnails from youtube but somehow fails to do so and throws you an error, or the network images coming from a different domain throw an error. All these scenarios possibly hint at a single cause, Cross-Origin Resource Sharing (CORS). We’ll talk about CORS ahead but before that let’s understand how things work on the web at Flutter end and why CORS is the reason for your trouble. Flutter web uses two different renderers, each of which has different functionality, advantages, and limitations.

HTML renderer:
HTML renderer is one of the renderers responsible to render your web app on mobile browsers. It uses the HTML <img> element to render images which has certain advantages such as image optimization, memory management, and above all, it allows you to display images from arbitrary sources.

  1. Uses HTML, CSS, Canvas 2D, and SVG to render UI.
  2. Uses <img> and <picture> elements to render images.
  3. Display images from arbitrary sources.
  4. Advantages with browser caching.

But wait. If an HTML renderer can easily display images from arbitrary sources without any extra load then why are we facing issues? You’ll get to know that ahead.

HTML renderer despite having certain advantages does have a few limitations too but the one that matters is that it has limited access to image data i.e no image manipulation, no image pixels data hence limited use.

CanvasKit renderer:
It’s one of the renderers responsible for rendering your UI on desktop browsers and for that purpose it uses WebGL. It uses the HTML <canvas> element to render images and has far better advantages over HTML renderer when it comes to having control of image data which furthermore helps with image sizing, and reading more pixels data, and since it uses WebGL you have superlative control over the image.
To take the advantage of CanvasKit renderer and WebGL you will need to configure CORS for your data.

  1. Uses WebGL to render UI.
  2. Advantages with image sizing.
  3. Custom image algorithms.
  4. Access to image data for manipulation(if CORS configured).

Cross-Origin Resource Sharing i.e CORS
You would have heard this word a lot of times above and might be wondering what it is and why we need to deal with it. Well, it’s a security feature implemented by web browsers that prevent a web page from making requests to a different domain than the one that the page is served from. So basically, when you use <img> <picture> or <canvas> elements, the browser automatically blocks any data regarding pixels if the data is coming from a different domain. Therefore, you need to configure your CORS policy for the domain your images are coming from to be able to let canvaskit renderer works to its ability.

To curb this resource-sharing issue for your Flutter web app there are a few different solutions that you can implement,

Using HTML renderer

As we’ve read, HTML renderer though not the default renderer for Flutter for the web but does allow you to display images from arbitrary sources without any need for extra configurations. So, we can achieve that by forcing our web app to use an HTML renderer despite using the default CanvasKit renderer and we can do that by running the following command on the terminal,

flutter run -d chrome - web-renderer html

Using CORS configuration

Another way is to use your default renderer i.e CanvasKit renderer because using an HTML renderer has limitations that the default renderer solves but to be able to use images from arbitrary sources in CanvasKit renderer you will need to configure your CORS file for the domain you’re fetching the images from.
Below are the steps to configure your CORS file for the Firebase domain, in this scenario I’m assuming that the images are coming from the Firebase storage so we need to set up the CORS for the Firebase to do so follow the below steps,

  1. Download the Google Cloud sdk.
  2. In your Flutter project, create the cors.json file.
  3. In the terminal, navigate to the google-cloud-sdk/bin and run gcloud init.
  4. Authenticate yourself and choose your project.
  5. Run gsutil cors set cors.json gs://<your-bucket-name>.appspot.com where bucket-name is the name of the bucket where images are stored on Firebase storage.

This is how your cors.json file should look like, where I’ve set the origin as “*” which makes it accessible for all domains but you can replace it with your specific domain, for ex: “https://your-example-website.appspot.com”.

[
{
"origin": ["*"],
"method": ["GET"],
"maxAgeSeconds": 3600
}
]

Configure URL strategy

Flutter Web has two URL strategies for its apps

By default, Flutter uses the hash in its web app URLs but that can be a problem considering indexing and SEO-related queries on the web which can be an issue considering one of the critical aspects of the web. This is important because it allows the app to handle different types of URLs consistently and predictably.

For example, the URL strategy can be used to specify how the app should handle deep links, which are URLs that link directly to specific pages or sections within the app. This can make it easier for users to share links to specific parts of the app with other people, and it can also help improve the overall user experience of the app by making it more intuitive and navigable.

  1. Flutter web supports two ways to configure URLs.
    Hash(default): flutterexample.dev/#/path/to/screen.
    Path: flutterexample.dev/path/to/screen.
  2. To use PathUrlStrategy one needs to configure web server rewrites to index.html.
  3. You need to make sure that you include <base href=”/”> inside the <head> section of your web/index.html when using the path URL strategy.

https://gist.github.com/Aditsyal/e084e78dd4e77b335ec9fc93caa5fca2

The flutter_web_plugins library provides this method. The above method changes the URL strategy in your Flutter web app but you also need to handle various situations in the above scenario like handling it for the mobile app which involves a few conditional statements to make the implementation further simpler you can use the below plugin.

Plugin: url_strategy

  1. Use this plugin to simplify the implementation.
  2. It’s based on the previous solution provided by the flutter_web_plugins.
  3. You only need to call a single function.
  4. No need to use conditional imports.

https://gist.github.com/Aditsyal/abbc544db55a5f2d37d310ba635c1f1f

Plugins & Custom code in JS:

If you’ve integrated your existing Flutter code to be compatible with Flutter web then you might’ve come across a situation where the plugins that worked for you earlier might cause problems after the Flutter web integration. Well, this is highly possible as not all your previous plugins might support Flutter web,

Replacing your plugins:
One way is to replace your older plugins with the ones that are compatible with Flutter web, now this may or may not help you but you’ve to explore all the options available to avoid creating a plugin yourself that fits your requirements and also support Flutter web.

Custom native javascript code:
Now, having all plugins replaced or whatever could’ve been replaced you could still be in a situation where you want to get something done on the Flutter web app and there’s no plugin for that or maybe you know to achieve the task you could easily get it done using Javascript, yes you could write a javascript code and integrate it in your Flutter web app using the following steps,

1. Create a js file in the web folder of your project.

2. Write your custom method.

https://gist.github.com/Aditsyal/8f259742abce0fce69db3f49b4ff1ef6

3. Update the index.html file.

<script src="custom.js" defer></script>

4. Use the method in your dart code.

js.context.callMethod(
'customAlertMessage', ['Hey this is custom IS code! ']):

Conclusion:

In conclusion, Flutter for the web is a powerful framework for building modern, high-performance web applications. Despite its relative newcomer status, Flutter has quickly gained popularity among developers for its fast, expressive, and flexible approach to building user interfaces. However, like any new technology, Flutter for the web comes with its challenges. These challenges can range from the relative immaturity of the Flutter ecosystem to the lack of support for certain features and functionality. Despite these challenges, many developers are drawn to Flutter for the web because of its ability to create beautiful, interactive, and responsive web applications quickly and easily. By understanding the challenges and finding solutions to overcome them, developers can take full advantage of the benefits that Flutter for the web has to offer.

Thanks for reading this article.
If I got something wrong? Let me know in the comments. I would love to improve.


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us:
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! For any flutter-related queries, you can connect with us on Facebook, GitHub, Twitter, and LinkedIn.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.

Related: SMS Using Twilio In Flutter

Related: Using SharedPreferences in Flutter

Need expert help building your Flutter app? Talk to FlutterExperts for architecture, development, and consulting support.

Complete Guide to Retrofit in Flutter 2026

0

Hello Everyone..!!!! Today we are learning about Retrofit In Flutter. In any mobile application, communication with the server to fetch the data or send the data to the server via API is a basic need in Retrofit.dart is a type conversion dio client generator using source_gen and inspired by Chopper and Retrofit.

If you’re looking for the best Flutter app development company for your mobile application then feel free to contact us at — support@flutterdevs.com.


Table Of Contents:

Introduction

Add Dependency

Implementation

Conclusion

GitHub Link



Introduction:-

Retrofit is a Dio client that makes consuming Rest APIs easier for us. Build runner is used for code generation in Dart, apart from the pub. JSON Serialization creates a model class from JSON data.

Almost in every Android and IOS, we have to use Rest API and Retrofit is best to arrange the API properly. For fetching the API we can also use many libraries but Retrofit is easy to use and has clean code.


Add Dependency:-

To add the dependency first you have open pubspec.ymal file and then add some dependencies,

cupertino_icons: ^1.0.2
retrofit: ^3.3.1
json_annotation: ^4.7.0

dev_dependencies:
flutter_test:
sdk: flutter
: ^2.3.2
retrofit_generator: ^4.2.0

we add retrofit, json_annotation, build_runner, and retrofit_generator. Retrofit is a dio client generator using source_gen, inspired by Chopper and Retrofit. JSON annotation is used to create code for JSON serialization and deserialization. Build Runner is the build system for Dart code generation and modular compilation. Retrofit Generator is a dio client generator using source_gen, inspired by Chopper and Retrofit.


Implementation:-

Welcome to my blog… Now we start the application, by creating a new flutter application. First, we have to create an abstract API request class.

@RestApi(baseUrl: "http://www.json-generator.com/api/json/get/")
abstract class RestClient {
factory RestClient(Dio dio) = _RestClient;
@GET("/ceLGCumWjS?indent=2")
Future<List<Post>> getTasks();
}

In this, we define baseUrl and then create a Rest-client abstract class in which we create _restclient which is dio type, and then use get because we use get API and call the list of API. RestClient class is responsible for handling all the network call methods. In the above code, it will show an error on the _RestClient variable, which will be resolved with steps we see later on in this post.


@JsonSerializable()
class Post{
int index;
String name;
String picture;
String gender;
int age;
String email;
String phone;
String company;

Post({
this.index,
this.name,
this.picture,
this.gender,
this.age,
this.email,
this.phone,
this.company});

factory Post.fromJson(Map<String, dynamic> json) => _$PostFromJson(json);
Map<String, dynamic> toJson() => _$PostToJson(this);
}

After that, we create our model class in which we pass all the data we want to fetch from the server(API).

After that, we have to run two commands by which we can create the g.dart class:

# dart
dart pub run build_runner build

# flutter
flutter pub run build_runner build

In the home. dart class, we create UI and call the API. In this, we create AppBar, passing the title and title’s style.

AppBar(
backgroundColor: Colors.blue[300],
centerTitle: true,
title: Text(
'Flutter Retrofit',
style: TextStyle(
fontSize: 25, color: Colors.white, fontWeight: FontWeight.bold),
),
),

After that, we create a FutureBuilder type method with the name _buildBody and pass BuildContext in this method. And pass the Post list in the FutureBuilder method. We call the RestClient by creating a client. And return the FutureBuilder.

FutureBuilder<List<Post>> _buildBody(BuildContext context) {
final client = RestClient(Dio(BaseOptions(contentType: "application/json")));
return FutureBuilder<List<Post>>(

future: client.getTasks(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
final List<Post> posts = snapshot.data!;
return _buildPosts(context, posts);
} else {
return Center(
child: CircularProgressIndicator(),
);
}
},
);
}

In this, we also call the _buildPosts method which is List-view. and return the ListView.Builder. In itemCount, we pass the length posts list. And in item builder, we return the Card and fetch the data from API.

ListView _buildPosts(BuildContext context, List<Post> posts) {
return ListView.builder(
itemCount: posts.length,
padding: EdgeInsets.all(8),
itemBuilder: (context, index) {
return Card(
elevation: 4,
child: ListTile(
title: Text(
posts[index].name,
style: TextStyle(fontWeight: FontWeight.bold),
),
subtitle: Text(posts[index].email),
leading: Column(
children: <Widget>[
Image.network(posts[index].picture,width: 50,height: 50,
),
],

),
),
);
},
);
}

Conclusion:

In this article, we learn how to implement Retrofit in Flutter Application. In this, we learn many things like how to create the model and how to generate g.dart file

❤ Thanks for reading this article ❤❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.


GitHub Link:

Find the source code of the RetroFit Application :

GitHub – flutter-devs/retrofit_demo
A new Flutter project. This project is a starting point for a Flutter application. A few resources to get you started…github.com


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us:
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! For any flutter-related queries, you can connect with us on Facebook, GitHub, Twitter, and LinkedIn.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.

Related: Rest API Using GetX

Need expert help building your Flutter app? Talk to FlutterExperts for architecture, development, and consulting support.


MultiThreading In Flutter

0

Flutter, the cross-platform developed by google is much in the talk about its splendid User Interface ability and animations. The power of it is hindered if somehow we suffer issues of screen freezing, animations not working as intended, and screen jumping which in turn make the whole user experience negative. Usually, what triggers this phenomenon is either accessing multiple api requests synchronously, image processing, animations, or any other lengthy operations.

If you’re looking for the best Flutter app development company for your mobile application then feel free to contact us at — support@flutterdevs.com.

A lot of developers want to address this issue in their applications so that such a situation may not arise at all which could be easily done by creating multiple Isolate which are separate threads with their event loop that don’t share a memory with the main isolate (thread) that runs the Flutter app for such tasks. This process is called Multithreading.

Multithreading is a technique by which several processors can use a single code set at different execution stages.

Dart is a single-threaded language: All dart code runs in a single isolate, making them so important that the entirety of dart applications runs in an isolate.

Need for Isolate in Flutter

In Flutter, everything is executed in a single main thread even in the case of async / await thus Multithreading is essential because when working on mobile platforms, some expensive operations within this flow either need to be asynchronous or should run on the background threads. We accomplish this process with the use of Isolates.

Isolates are useful for running code that may take a long time to complete without blocking the main thread, which is important for providing a smooth and responsive user experience. Multithreading allows for parallel execution of two or more parts of a program, which can make the program run faster by taking advantage of the multiple cores or CPUs available on the computer. It can also make the program more responsive to the user by allowing it to perform multiple tasks at the same time.

Isolate explanation by the flutter team

Before deep-diving into the types of isolates there are certain things to keep in mind :

No communication between threads : isolate created possess no communication between each other including the custom object in flutter isolate .

Communication is done with help of ports : Any communication between threads is carried through ports i.e. — SendPort & ReceivePort

Types Of Isolate In Flutter

Isolate in flutter can be created in these 2 ways :

: Computefunction

: Spawnfunction

: spawn function

Creating an isolate using spawn is simple, it requires 2 arguments: a void Function(dynamic) callback, and an optional dynamic message.The callback function represents the entry point of the isolate, and the message argument can be used to pass data to the isolate when it is spawned.

Here’s an example of how you can use Isolate.spawn to create an isolate:

isolate spawn

This will create an isolate and run the isolateFunction callback in the isolate. The main isolate will pass the string “Hello from the main isolate!” as the message argument to the isolate, which will be printed by the isolate’s isolateFunction.

Note that isolates are separate threads of execution, and they do not share a memory. This means that you will need to use inter-isolate communication techniques, such as message passing or shared memory, to pass data between isolates.

Compute function

In Flutter, you can use the compute function to run a function in a separate isolate. The compute function is a convenience wrapper around the Isolate.spawn function that makes it easier to use isolates for compute-intensive tasks.

Here’s an example of how you can use the compute function to create an isolate in Flutter:

isolate compute

In this example, the computeIntensiveFunction is run in a separate isolate using the compute function. The compute function returns a Future that completes with the return value of the function when it is finished. In this case, the computeIntensiveFunction returns the square of the input value, so the result variable will be set to 10000.

Note that the function passed to the compute the function must be a top-level function or a static method, and it must take a single argument of type dynamic and return a value.

How do Isolates Communicate with each other?

To communicate between isolates, you can use a combination of SendPort and ReceivePort objects.

Here’s an example of how you might use these classes to send a message from the main isolate to a new isolate:

To send a message from the new isolate back to the main isolate, you can use the SendPort object that was passed from the main isolate to the new isolate.

Here’s an example of how you might use this SendPort to send a message back to the main isolate:

In the main isolate, you can use a ReceivePort to listen for incoming messages from the new isolate.

Here’s an example of how you might use a ReceivePort to receive a message from the new isolate:

The flutter_isolate the package provides a way to run Dart code in a separate isolate (a separate execution context). Isolates are used to run code concurrently and can be useful for implementing load balancing, as they allow you to distribute workloads across multiple threads.

Here’s an example of how you can use the flutter_isolate package to load balance a workload in a Flutter application:

This example creates a list of three isolates, each running the same workload. You can then distribute the workload across the isolates by calling the run method on each isolate.

You can customize the behavior of the isolates by passing in additional options when creating them. For example, you can specify a custom message handler for the isolate, or configure the isolate to run in a background isolate. Please refer to the flutter_isolate package documentation for more details.

Reference :

flutter_isolate | Flutter Package
A Dart isolate is roughly equivalent to a single, independent execution thread. In a Flutter context, creating…pub.dev


Thanks for reading this article ❤

Clap 👏 If this article helps you.

Feel free to post any queries or corrections you think are required…✔

From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! You can connect with us on Facebook, GitHub, Twitter, and LinkedIn for any flutter-related queries.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences!

Related: SMS Using Twilio In Flutter

Related: Using SharedPreferences in Flutter

Need expert help building your Flutter app? Talk to FlutterExperts for architecture, development, and consulting support.

Configuration Testing With Test Cases In Flutter

0

Hi everyone! today we learn about Configuration Testing with Test Cases In Flutter. Configuration Testing is a software testing technique in which the software application is tested with multiple combinations of software and hardware to evaluate the functional requirements and find out optimal configurations under which the software application works without any defects or flaws.

As discussed above, Configuration Testing is software testing where the application under test has to be tested using multiple combinations of Software and Hardware.

If you’re looking for the best Flutter app development company for your mobile application then feel free to contact us at — support@flutterdevs.com.


Table Of Contents::

Configuration Testing Example

Pre-requisites for Configuration Testing

Objectives of Configuration Testing

How to do Configuration Testing

Sample Test Cases

Conclusion


Configuration Testing Example:

et’s understand this with an example of a Desktop Application:

Generally, Desktop applications will be of 2-tier or 3-tier, here we will consider a 3-tier Desktop application that is developed using Asp .NET and consists of a Client, Business Logic Server, and Database Server where each component supports the below-mentioned platforms.

  • Client Platform — Windows XP, Window7 OS, windows 8 OS, etc.
  • Server Platform — Windows Server 2008 R2,Windows Server 2008 R2, Windows Server 2012R2
  • Database –SQL Server 2008, SQL Server 2008R2, SQL Server 2012, etc.

A tester has to test the Combination of Client, Server, and Database with combinations of the above-mentioned platforms and database versions to ensure that the application is functioning properly and does not fail.

Configuration testing is not only restricted to Software but also applicable to Hardware which is why it is also referred to as Hardware configuration testing, where we test different hardware devices like Printers, Scanners, Webcams, etc. that support the application under test.

Pre-requisites for Configuration Testing:

For any project before starting with the config test, we have to follow some pre-requisites

  • Creation of a matrix that consists of various combinations of software and hardware configurations
  • Prioritizing the configurations as its difficult to test all the configurations
  • Testing every configuration based on prioritization.

Objectives of Configuration Testing:

The objectives of configuration Testing are to

  • Validating the application to determine if it fulfills the configurability requirements
  • Manually causing failures which help in identifying the defects that are not efficiently found during testing (Ex: changing the regional settings of the system like Time Zone, Language, Date time formats, etc.)
  • Determine an optimal configuration of the application under test.
  • Analyzing the system performance by adding or modifying the hardware resources like Load Balancers, increasing or decrease in memory size, connecting various printer models, etc.
  • Analyzing system Efficiency based on prioritization, how efficiently the tests were performed with the resources available to achieve the optimal system configuration.
  • Verification of the system in a geographically distributed Environment to verify how effectively the system performs.
  • For Ex: With servers at different locations and clients at different locations, the system should work fine irrespective of the system settings.
  • Verifying how easily the bugs are reproducible irrespective of the configuration changes.
  • Ensuring how traceable the application items are by properly documenting and maintaining the easily identifiable versions.
  • Verifying how manageable the application items are throughout the software development life cycle.

How to do Configuration Testing:

In this section, we will discuss the strategy that needs to be followed for configuration testing types there are two types of configuration testing as mentioned below

Software Configuration Testing

Hardware Configuration Testing

  • > Software Configuration Testing:

Software configuration testing is testing the Application under test with multiple OS, different software updates, etc. Software Configuration testing is very time-consuming as it takes time to install and uninstall different software that is used for the testing.

Instead of Installing and uninstalling the software in multiple physical machines which is time-consuming, it’s always better to install the application/software in the virtual machine and continue testing. This process can be performed by having multiple virtual machines, which simplifies the job of a tester

Software configuration testing can typically begin when

  • Configurability requirements to be tested are specified
  • The test environment is ready
  • The testing Team is well-trained in configuration testing
  • Build released is unit and the Integration test passed

The typical Test Strategy that is followed to test the software configuration test is to run the functional test suite across multiple software configurations to verify if the application under test is working as desired without any flaws or errors.

Another strategy is to ensure the system is working fine by manually failing the test cases and verifying efficiency.

Example:

Say there is a Banking Application, which has to be tested for its compatibility across multiple browsers when the application is hosted in an environment where all the prerequisites are present it might pass the unit and Integration Testing in the test lab.

But if the same application is installed in a client place and the machines are missing some software updates or the versions on which the application is dependent directly or indirectly there is a chance that the application might fail. To avoid this kind of situation, it’s always suggested to fail the tests manually by removing some of the reconfigurability requirements and then proceed with the testing.

  • > Hardware Configuration Testing:

Hardware configuration testing is generally performed in labs, where we find physical machines with different hardware attached to them.

Whenever a build is released, the software has to be installed in all the physical machines where the hardware is attached, and the test suite has to be run on each machine to ensure that the application is working fine.

To perform the above task a significant amount of effort is required to install the software on each machine, attach the hardware, and manually run or even automate the above-said process and run the test suite.

Also, while performing hardware configuration tests, we specify the type of hardware to be tested, and there are a lot of computer hardware and peripherals which make it quite impossible to run all of them. So it becomes the duty of the tester to analyze what hardware is mostly used by users and try to make the testing based on prioritization.

Sample Test Cases:

Consider a Banking Scenario to test for hardware compatibility. A Banking Application that is connected to Note Counting Machine has to be tested with different models like Rolex, Strob, Maxsell, Stok, etc.

Let’s take some sample test cases to test the Note Counting Machine

  • Verifying the connection of the application with the Rolex model when the prerequisites are NOT installed
  • Verifying the connection of the application with the Rolex model when the prerequisites are installed
  • Verify if the system is counting the notes correctly
  • Verify if the system is counting the notes incorrectly
  • Verifying the tampered notes
  • Verifying the response times
  • Verifying if the fake notes are detected and so on

The above test cases are for one model, and the same has to be tested with all the models available in the market by setting them up in a difficult test lab. Hence, it is advisable to outsource the hardware configuration testing to organizations that specialize in them.

Conclusion:

In Software Engineering, Configuration Testing should be given equal importance as other testing types. Without configuration testing being performed, it is difficult to analyze the optimal system performance, and also software might encounter compatibility issues that are supposed to run.

❤ ❤ Thanks for reading this article ❤❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us:
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a Flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! For any flutter-related queries, you can connect with us on Facebook, GitHub, Twitter, and LinkedIn.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.

Need expert help building your Flutter app? Talk to FlutterExperts for architecture, development, and consulting support.

NFC In Flutter

0

This blog will explore the NFC in Flutter. We will perceive how to execute a demo program in your flutter applications. Near-field communication — NFC is something that has eased up our lives in many ways. Let’s get through it in brief.

If you’re looking for the best Flutter app development company for your mobile application then feel free to contact us at — support@flutterdevs.com.


Table Of Contents::

What is NFC?

NDEF

Flutter with NFC

What is an NFC tag?

What is an NFC reader?

Platform Setup

Code Implement

Conclusion

Github Link



What is NFC?

NFC (near-field communication), is a short-range(depending on hardware, usually around 3 cm–5 cm) wireless technology that allows your phone to act as a transit pass or a credit card, speedily transfer data, or instantly connect with Bluetooth devices like headphones or speakers.

NFC is not some entirely new technology. It’s simply an evolved form of RFID (radio frequency identification) technology that has already been used around for decades. If you’ve ever used a key card (punch card) to access an office building or hotel room, you already know how it works.

NFC is based on RFID technology but has a much lower transmission range.

NFC only has a maximum range of a few centimeters, at most. And in so many smartphone-related applications, you’ll find that the software will only initiate communication if there is some physical contact. This is to prevent accidental triggers — especially the point that the technology is used for transferring sensitive/tactful data.

NDEF:-

NDEF is a Dart library for encoding & decoding NDEF records, supporting multiple types including (grouped by Type Name Format):

-> NFC Well Known:

  • Text
  • Connection handover
  • Smart poster
  • URI with a well-known prefix
  • Digital signature

-> Media (MIME data):

  • Easy Bluetooth pairing / Bluetooth low-energy
  • other MIME data

-> Absolute URI

Flutter with NFC:-

You will find multiple packages in the pub. dev. The one I chose is called nfc_manager and supports Android and iOS. This package is something that is being used very often whenever we need to work with NFC in a flutter.

The project I will present here is based on the counter-example of Flutter with NFC. The good part is you can easily store your current value on a tag and read a value from it. This storage does not need any device or any power source. The tag acts as an enduring memory layer for the app.

What is an NFC tag?

An NFC tag is a small integrated circuit consisting of a copper coil and a few amounts of storage. We can easily read and write data to it only when some other NFC device is brought near to it because it doesn’t contain a power source. The proximity of the NFC device induces its power in the title and that enables data transmission.

What is an NFC reader?

Any powered device which has its own NFC coil (like a tablet, smartphone, etc) can act as an NFC reader. With the help of its battery, the reader device gets able to generate an electromagnetic field, which powers the tags that are brought near it. Also, a basic example of a reader is a payment terminal, which makes use of NFC to authenticate a credit & debit card.

Platform Setup:-

  • Android requires use permission in the app’s main manifest file, as follows:
<uses-permission android:name="android.permission.NFC"/>

iOS Setup :

<key>NFCReaderUsageDescription</key>
<key>com.apple.developer.nfc.readersession.felica.systemcodes</key>

Code Implement:

Let’s get started with the NFC demo project.

Global flag if NFC is available.

bool isNfcAvalible = false;

void main() async {
WidgetsFlutterBinding.ensureInitialized(); // Required for the line below
isNfcAvalible = await NfcManager.instance.isAvailable();
runApp(const MyApp());
}

This is how we write NFC tags.

NfcManager.instance.startSession(onDiscovered: (tag) async {
Ndef? ndef = Ndef.from(tag);

NdefMessage message = NdefMessage([
NdefRecord.createExternal('android.com', 'pkg',
Uint8List.fromList('com.example'.codeUnits))
]);

try {
await ndef!.write(message);
NfcManager.instance.stopSession();
print("Counter witten a tag");
// _alert('Counter written to tag');

return;
} catch (e) {
print('error $e');
return;
}
}),

And this is how we read from the tag.

var ndefMessage = ndef?.cachedMessage!;And this is how we read from the tag.
if (ndefMessage!.records.isNotEmpty &&
ndefMessage.records.first.typeNameFormat ==
NdefTypeNameFormat.nfcWellknown) {
final wellKnownRecord = ndefMessage.records.first;if (wellKnownRecord.payload.first == 0x02) {
final languageCodeAndContentBytes =
wellKnownRecord.payload.skip(1).toList();
final languageCodeAndContentText =
utf8.decode(languageCodeAndContentBytes);
final payload = languageCodeAndContentText.substring(
2);
final storedCounters = int.tryParse(payload);
if (storedCounters != null) {
print("Success!");
print('Counter restored from tag');
}
}

As working with NFC with iOS, we need to stop the session after every tags:-

if (Platform.isIOS) {
NfcManager.instance.stopSession();
}

Conclusion:

In this article, we get to learn how to work with NFC in Flutter Application. This article gives a good understanding of how to read and write to a tag so that one can easily make data transfer.

❤ ❤ Thanks for reading this article ❤❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.


Github Link:

Find the source code of the NFC Application :

GitHub – flutter-devs/my_nfc_demo
A new Flutter project. This project is a starting point for a Flutter application. A few resources to get you started…github.com


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us:
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! For any flutter-related queries, you can connect with us on Facebook, GitHub, Twitter, and LinkedIn.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.

Related: SMS Using Twilio In Flutter

Related: Using SharedPreferences in Flutter

Need expert help building your Flutter app? Talk to FlutterExperts for architecture, development, and consulting support.


Flutter Quill: Rich Text Editor In Flutter Application

Hello Everyone…!!!!. Today we start with an interesting topic that is used for rich text. Flutter Quill is a rich text editor and also a Quill component for Flutter.

If you’re looking for the best Flutter app development company for your mobile application then feel free to contact us at — support@flutterdevs.com.


Table Of Content

Introduction

Add Dependency

Configuration

Implementation

GitHub Link


Introduction:

FlutterQuill is a rich text editor and a Quill component for Flutter. This library is a WYSIWYG editor built for the modern mobile platform, with web compatibility under development. This dependency is very useful for any editor app. We don’t need any other side for code for any texting editor.


Add Dependency:

To add the dependency first you have to open pubspec. ymal file and then add some dependencies,

dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
flutter_quill: ^6.1.6

We have to add the updated package of flutter_quill. Which is used as a Rich Text Editor in a flutter.


Configuration:

The Quill Toolbar class lets you customize which formatting options are available.

> Font Size:- Within the editor toolbar, a drop-down with font-sizing capabilities is available. This can be enabled or disabled with showFontSize. When enabled, the default font-size values can be modified via optional fontSizeValues. FontSizeValues accepts a Map<String, String> consisting of a String title for the font size and a String value for the font size. Example:

fontSizeValues: const {'Small': '7', 'Medium': '20.5', 'Large': '40'},

>Font Family:- If you want to use the font family, you have to add the family to the assets folder and pass in fontfamilyValues.

>Custom Buttons:- You may add custom buttons to the end of the toolbar, via the custom buttons option, which is a List of QuillCustomButton.

QuillCustomButton(
icon:Icons.ac_unit,
onTap: () {
debugPrint('snowflake');
}

>showAlignmentButtons:- In showAlignmentButtons, we have many properties like controller, iconSize, iconTheme, showLeftAlignment, showCenterAlignment, showRightAlignment, showJustifyAlignment, afterButtonPressed.

>Translation:- The package offers translations for the quill toolbar and editor, it will follow the system locale unless you set your own locale with:

QuillToolbar(locale: Locale('fr'), ...)
QuillEditor(locale: Locale('fr'), ...)

Implementation:

In the implementation of Flutter Quill first, we have to create a Flutter project with the name flutter_quill_demo. There are two things in QuillController and Quill-editor. In Quill-controller.

QuillController _controller = QuillController.basic();

here we define the controller as QuillController.basic(). In the Toolbar() we can pass many things like QuillController, toolbarIconAlignment, toolbarIconAlignment, showDividers, showBoldButton, showBoldButton, showUnderLineButton, showJustifyAlignment and many more.

And second is QuillEditor.basic(), in this editor we can type anything.

Scaffold(
body: SingleChildScrollView(
child: Column(
children: [
Container(
margin: EdgeInsets.only(top: 20,left: 10,right: 10,bottom: 20),
width: MediaQuery.of(context).size.width,
height: 80,
decoration: const BoxDecoration(
image: DecorationImage(
image: NetworkImage('https://user-images.githubusercontent.com/10923085/119221946-2de89000-baf2-11eb-8285-68168a78c658.png'),
fit: BoxFit.cover
)
),
),
Padding(padding: const EdgeInsets.only(top: 0),
child:
QuillToolbar.basic(controller: _controller,
fontSizeValues: const {'Small': '7', 'Medium': '20.5', 'Large': '40'},
showAlignmentButtons: false ,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
decoration: const BoxDecoration(
boxShadow: [BoxShadow(
color: Colors.lightBlueAccent,
offset: Offset(5.0, 5.0) ,
blurRadius: 10.0,
spreadRadius: 2.0
),
BoxShadow(
color: Colors.white,
offset: Offset(0.0, 0.0),
blurRadius: 0.0,
spreadRadius: 0.0
)
]
),
child:
QuillEditor.basic(controller: _controller, readOnly: false),),
)
],
),
),
);

When we run the application, we ought to get the screen’s output like the underneath screen capture.

In this picture, as you see we can add colors to our text. And by this, we can create an attractive text list.

In this picture, you can see that we can change the font style for particular text. and also for particular paragraphs.

Flutter Quill Demo

GitHub Link:

Find the source code of the Flutter Quill:

GitHub – flutter-devs/flutter_quill_demo
You can’t perform that action at this time. You signed in with another tab or window. You signed out in another tab or…github.com
.


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us:
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! For any flutter-related queries, you can connect with us on Facebook, GitHub, Twitter, and LinkedIn.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.

Related: Flutter Text To Speech

Related: Google ML Kit for Flutter: Complete Guide to Barcode Scanning, Face Detection & Text Recognition (2026)

Need expert help building your Flutter app? Talk to FlutterExperts for architecture, development, and consulting support.


Testing In Flutter

0

Testing is an essential part of the app development process, yet it is often overlooked or provided minimal attention. This is a mistake that can have serious consequences, as faulty or buggy apps can lead to user frustration, negative reviews, and even financial losses. In this medium post, we will delve into the importance of testing in app development and various types of testing that can ensure the quality and reliability of your flutter apps.

Testing is an integral phase in the development cycle of an application ensuring that the app is of substantial quality, planned to perfection, and perfectly executed and the phase that commands the most time in the development cycle.

Objective Of Testing

In the app development process, Testing is crucial for ensuring that your app functions properly and as intended. Through testing, you can identify and address any bugs or defects early on, saving time and resources in the long run. Testing also helps to ensure that your app is reliable and maintainable. By writing tests, you can confirm that changes made to the app do not negatively impact its existing functionality, and feel confident in making future changes. Ultimately, testing is a key component of delivering a high-quality app to your users.

  • Automating Process
  • Retaining feature on further scaling
  • Fixing bugs easily
  • Timely feedback on bugs.
  • etter Documentation, Code coverage

Flow Of Test Cases

the flow of test cases

Development Testing In Flutter

Dart language & Flutter framework provides extensive support for the automated testing of an application at different levels.

Flutter provides 3 kinds of tests to test your app:

  • Unit Testing
  • Widget Testing
  • Integration Testing

Unit Testing

Unit tests are used to test individual functions or classes in your app. They are usually isolated from the rest of the app, so they don’t rely on any external state. You can run unit tests from the command line or an IDE by using the flutter test command.

Widget Testing

It is used to test the interaction between different widgets in your app. They allow you to test how widgets behave when they are nested within each other, and how they respond to user input. You can create widget tests by using the flutter test command and running them with the flutter drive command.

Integration Testing

Integration testing includes testing user flows through the app, as well as testing interactions with external APIs or databases. In Flutter, you can use a package like Flutter Driver to create integration tests that run on the command line. These tests can be run on real devices or simulators/emulators.

Test Types Relationship ( Isolation -Time Consumed )

Test Types Relationships

Unit tests are the most isolated and fastest to run, as they test a small, specific unit of code in isolation. They are usually focused on testing individual functions or methods, and do not require the app to be fully built or running.

Widget tests are slightly less isolated, as they test the behavior of a single widget in the context of a running app. They allow you to test the interactions between a widget and its dependencies, as well as the widget’s appearance. Widget tests are typically faster to run than integration tests but may take longer than unit tests.

Integration tests are the least isolated and most time-consuming to run, as they test the interaction between multiple components of the app. They require the app to be fully built and running and can be used to test the app’s behavior end-to-end. Integration tests are useful for verifying that the different parts of the app are working together correctly and as expected.

We are on board with the need for testing and the types of it. Herewith are some key integral parts for writing test cases :

  • : Write the test case inside the main function in the test dart file. All the test cases come under the main function.
  • : Test cases are written under test() function or testWidgets() in case of widget tests.
  • : test function requires a description and test code. description should be as clear for naive understanding as well
  • : Add the test dependency needed at the testcode part.
  • : Different testcases can be grouped based on similarity using the grouping() function.
  • : All the test cases are written using three AAA format

While writing test cases one should be well acquainted with the terminologies used in writing those test cases

Terminologies Used In Test Cases

  • : main() : All the test cases are written inside this function.
  • : group() : All the similar test cases are grouped together on a similarity basis
  • : test() ,testWidgets () : require a description and testcode. description should be apparent clear for even the management person to understand and infer. test code should be written under this function.
  • : Setup, setUpAll: setup common code required for each method. if written outside test cases available for all test cases.
  • : verify, expect: used to verify the test case results in the intended value
  • : tearDown, tearDownAll : used to dispose off things , methods
  • : pumpWidget(): Renders the UI from the given widget.
  • : tap(): Calls the onTap/onPress event of the widget.
  • : pump(): Gets the reflected changes in the Widget. (e.g. setState())
  • : pumpAndSettle(): Repeatedly calls the pump() method with duration until there is no frame to schedule.
  • : WidgetTester: Used to build and interact (re-render) widgets in the test environment.
  • : Finder: Class that allows you to search widgets in a test environment.
  • : Matcher: Verifies Finder locates a widget or multiple widgets in test environment.

Pattern Used In Writing Test Cases ( AAA Structure )

Using the AAA pattern can help you write test cases that are easy to understand and maintain, and can also help you catch errors and bugs more effectively.

  • Arrange: prepare and initialize
  • Act: invoke method testing
  • Assert: validate the result expected

The AAA (Arrange-Act-Assert) pattern is a common approach for writing test cases that can help you structure your tests clearly and logically. The AAA pattern consists of the following steps:

AAA pattern
  1. Arrange: Set up the necessary preconditions for the test. This may involve creating objects, setting up mock data, or performing other necessary setup tasks.
  2. Act: Perform the action that you want to test. This could be calling a function, interacting with a widget, or performing some other action.
  3. Assert: Verify that the action produced the expected result. This may involve checking the return value of a function, checking the state of an object, or verifying that some other condition is true.

Here’s an example of a test case written using the AAA pattern in Flutter:

Simple Test Cases In Flutter

Unit Testing

Unit testing involves testing individual parts of your app, like functions or classes, separately from the rest of the app.

Here is an example of a unit test for a Flutter function that makes an HTTP request using the http package:

unit-testing flutter

This test makes an HTTP GET request to the URL https://flutterdevs.org/get and then verifies that the status code 200 and the response body is as expected.

Note that this test is using the http package to make the HTTP request, but you could also use a mock HTTP library like mockito or dio_mock to test your HTTP client code without actually making real network requests.

Widget Testing

Widget testing involves verifying the behavior of individual widgets within your app. This function allows you to find elements using Finder objects and verify their behavior using Matcher objects.

Here is an example of a widget test for a FileWidget in Flutter:

This test creates an instance of FileWidget with a File object and then uses the WidgetTester to verify that the file name is displayed.

Integration Testing

Integration testing in Flutter involves testing how various parts of your app work together

Here is an example of an integration test for a payment feature in Flutter

This test launches the app, taps the Make Payment button, enters payment information, and taps the Submit Payment button. It then verifies that the payment was successful by checking for the presence of the text Payment Successful.

Code Coverage In Flutter

Code coverage is a measure of how much of your code is being tested by your test suite, understand how thorough your tests are, Identify areas of your code yet to be tested.

Code coverage in Flutter helps ensure that widgets are properly tested and can be measured using tools like coverage. These tools generate reports on tested code, aiding in identifying untested areas and improving the app’s overall quality. Tracking code coverage can also aid in monitoring testing progress and identifying areas for testing focus

Here’s an example of how to implement code coverage in Flutter:

  1. Install the coverage package:
flutter pub add coverage
  1. Run your tests with the coverage command:
flutter test --coverage

This will generate a coverage report in the coverage directory.

  1. To view the coverage report, you can use the coverage:format command:
flutter pub run coverage:format

This will generate an HTML coverage report that you can view in your web browser. The report will show you which lines of code were executed and which were not, so you can see which parts of your code still need to be tested.

For more information on code coverage in Flutter, you can check out the coverage package documentation:

coverage | Dart Package
Coverage provides coverage data collection, manipulation, and formatting for Dart. collect_coverage collects coverage…pub.dev

Herewith is a sample file to help you understand :

code coverage flutter

What’s Next

Tests might depend on classes that fetch data from live web services/databases which is inconvenient as this would fail the test in case of unexpected results from the database / API. To prevent this from happening we deal with such scenarios by Mocking.

This would be discussed in detail in the upcoming blog: Mocking In Flutter

References

Testing Flutter apps
The more features your app has, the harder it is to test manually. Automated tests help ensure that your app performs…flutter.dev

Find widgets
To locate widgets in a test environment, use the classes. While it’s possible to write your Finder classes, it’s…docs. flutter.dev


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us:
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! For any flutter-related queries, you can connect with us on Facebook, GitHub, Twitter, and LinkedIn.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.

Need expert help building your Flutter app? Talk to FlutterExperts for architecture, development, and consulting support.

Scrollbar Widget for Flutter Web

0

A scrollbar is an interaction technique in which continuous information/data (text, pictures, or any other type of content) can be scrolled in a predetermined direction (up, down, left, or right). By default scroll direction is vertical.


Table of Contents :

Scrollbar — Introduction

What is a scrollview widget? — Explained

Code Implement

Code File

Conclusion


Scrollbar — Introduction:

A vertical scroll bar gives the user the ability to scroll the content of a window up and down. Similarly, a horizontal scroll bar lets the user scroll the content from left to right.

Flutter has a few widgets that allow users to create a scrollable list of items. If the list is quite long, using a scrollbar would be the best option here which will make the user more comfortable with the interface.

However, The flutter’s ScrollView widgets (e.g. ListView, GridView, CustomScrollView) does not display any scroll bar by default. Fortunately, Flutter makes it very easy to display a scrollbar. We can use a ScrollBar widget and pass to it a widget that contains ScrollView as its child.

What is a ScrollView Widget?

A ScrollView is a widget that creates custom scroll effects using slivers. A container for a Scrollable that responds to drag gestures until a limit is reached, and then scrolling.

Following are a few scroll view examples:-

  • SingleChildScrollView
  • ListView
  • GridView
  • PageView
  • ReorderableListView
  • NotificationListener and etc

> SingleChildScrollView:-

This widget is useful when you have a box that contains a single widget that can be scrolled. For instance, a clock faces a time picker. But there’s something you need to make sure is that it can only be scrolled if the container gets too small in one/both axes (the scroll direction). To know more, click here.

> ListView:-

ListView is the most common scrolling widget. It displays its children’s items one after the other in the scroll direction(vertical by default). In the cross-axis, the children are supposed to fill up the ListView.

> GridView:-

A 2D arrangement of widgets that can be scrolled.

As the name suggests, you’ll see it being used wherever we want to present widgets in a Grid format. We can select the item we desire from the grid list by clicking on them. To know more, click here.

> PageView:-

A list that is scrollable and works page by page. Each child of a page view is forced to be the same size as the viewport.

PageController is what we use to control which page should be visible in the view. It makes users able to control the pixel offset of the content of the PageView. Along with that it also lets you control the offset in terms of pages, which are increments of the viewport size.

> ReorderableListView:-

A list in which a user can interactively reorder its elements/items by drag and drop. The onReorder parameter is what we require which will be called when a child widget is dragged and dropped to a new position. To know more, click here.

> NotificationListener:-

NotificationListener<T extends Notification>

It’s a widget that listens for Notifications bubbling over the tree. Notifications will activate the onNotification callback only when their runtimeType is a subtype of T.

Use the Notification. dispatch method for dispatching notifications.

Code Implement:-

We’ll see a demo code that will implement a Scrollbar in it.

> Constructor:-

Scrollbar({
Key? key,
required Widget child,
ScrollController? controller,
bool? thumbVisibility,
bool? trackVisibility,
double? thickness,
Radius? radius,
ScrollNotificationPredicate? notificationPredicate,
bool? interactive,
ScrollbarOrientation? scrollbarOrientation,
})

Let’s use it in our demo project.

Code:-

Expanded(
child: Scrollbar(
thickness: 20,
thumbVisibility: true,
trackVisibility: true,
interactive: true,
radius: const Radius.circular(15),
child: ListView.builder(...),
),
)

The demo project is for Flutter Web i.e., We’ll be able to see our scrollbar in Chrome(web). It doesn’t make any difference from the emulator view of the project or even it might be more fun.

Here, we will be using ListView as our ScrollView widget. We just need to wrap it with our ScrollBar to get it visible along with the list.

I’ve used a few parameters of the Scrollbar such as thickness (double?) which is responsible for setting the thickness of our scrollbar, and thumbVisibility (bool?) which is responsible to make sure that the scrollbar thumb should be visible, even when a scroll is not ongoing, trackVisibility (bool?) which indicates that the scrollbar track/path should be visible, interactive (bool?) indicates that scrollbar should be interactive and give response to dragging on the thumb or tapping in the track/path area, radius (Radius?) to make scrollbar thumb’s corners rounded and some other parameters make scrollbar more interactive with the user.

ListView.builder is the most common named constructor of ListView which we use when we want to create a list recursively without writing code again and again.

ListView.builder creates a scrollable, linear array of widgets. We get here a parameter named itemCount where we pass an integer value and many times the ListView.builder will execute the same lines of code we pass to another parameter named as itemBuilder.

The code of the below project will give the best understanding with ListeView. builder.

Code File:-

  • main. dart —
void main() {
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);

// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MultiProvider(
providers: [
ChangeNotifierProvider(create: (_) => LandingScreenProvider()),
ChangeNotifierProvider(create: (_) => FeedbackScreenProvider()),
ChangeNotifierProvider(create: (_) => RatingScreenProvider()),
],
child: MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
debugShowCheckedModeBanner: false,
home: const LandingScreen()
),
);
}
}
  • LandingScreen.dart —
body: Container(
padding: const EdgeInsets.only(
left: padding, right: padding, bottom: padding, top: 10),
width: size.width,
height: size.height,
child: ChangeNotifierProvider.value(
value: _landingScreenProvider,
child: Consumer<LandingScreenProvider>(
builder: (_, landingScreenProvider, __) {
print(" Loaded:${landingScreenProvider.isLoaded}");
return landingScreenProvider.isLoaded
? const Center(child: CircularProgressIndicator())
: Stack(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Padding(
padding: EdgeInsets.symmetric(
horizontal: padding)),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: () {
scaffoldKey.currentState?.openDrawer();
},
child: const BorderBox(
width: 50,
height: 50,
child:
Icon(Icons.menu, color: Colors.black),
),
),
GestureDetector(
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) =>
const SettingsScreen()));
},
child: const BorderBox(
width: 50,
height: 50,
child: Icon(Icons.settings,
color: Colors.black),
),
),
],
),
const Padding(padding: EdgeInsets.all(7)),
Text("City",
style: themeData.textTheme.bodyText2),
const Padding(padding: EdgeInsets.all(7)),
Text(
"Himachal Pradesh",
style: TextStyle(
fontSize: 50,
color: Colors.indigo.shade900,
fontWeight: FontWeight.w600),
),
const Padding(padding: EdgeInsets.all(7)),
const Divider(
// height: padding,
color: Colors.grey,
thickness: 0.7,
),
const SizedBox(
height: 5,
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
physics: const BouncingScrollPhysics(),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
"<\$220,000",
"For Sale",
"3-4 Beds",
">1000 sqft"
]
.map((filters) =>
ChooseOption(text: filters))
.toList(),
),
),
const SizedBox(
height: 10,
),
Expanded(
child: Scrollbar(
thickness: 20,
thumbVisibility: true,
trackVisibility: true,
interactive: true,
radius: const Radius.circular(15),
child: ListView.builder(
physics: const BouncingScrollPhysics(),
itemCount: imageItems.length,
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => Dummy(
imagesListModel:
imageItems[
index])));
},
child: ListBuilder(
itemData: imageItems[index],
index: index));
}),
),
)
],
),
],
);
}),
),
),

Conclusion:-

In this article, I have explained the Scrollbar widget, its uses, and almost all the related topics of it. We understood the implementation of the scrollbar with its parameters in the demo project. You can now make your version of the demo project.

❤ ❤ Thanks for reading this article ❤❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us:
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! For any flutter-related queries, you can connect with us on Facebook, GitHub, Twitter, and LinkedIn.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.

Related: Expansible Widget In Flutter

Need expert help building your Flutter app? Talk to FlutterExperts for architecture, development, and consulting support.


Module Testing In Flutter

0

Hi everyone! today we learn about Module Testing In Flutter. Module testing is a type of software testing where individual units or components of the software are tested.

The purpose of module testing is to isolate a section of code and verify its correctness. Module testing is usually performed by the development team during the early stages of software development.


Table Of Contents::

What is Module Testing?

Why does Module Testing

How to do Module Testing?

Example Tips for Module Testing

Unit Testing vs Module Testing

Challenges in Module Testing

Conclusion


What is Module Testing?

Module testing is defined as a software testing type, which checks individual subprograms, subroutines, classes, or procedures in a program. Instead of testing the whole software program at once, module testing recommends testing the smaller building blocks of the program.

Module testing is largely white-box oriented. The objective of doing Module, testing is not to demonstrate the proper functioning of the module but to demonstrate the presence of an error in the module.

Module-level testing allows to implementation of parallelism into the testing process by allowing the testing of multiple modules simultaneously.

Why does Module Testing:

Module Testing is recommended because

  • The probability of identifying errors or bugs in smaller chunks of the program becomes higher
  • Multiple modules can be tested simultaneously and hence supports parallel testing
  • The complexity of testing can be easily managed

How to do Module Testing?

  • For Module Testing, designing a Test Case is an important segment. While designing test cases for a module test, a tester has to consider two things.
  • Specification for the module
  • The module’s source code
  • Analyze the module’s logic by using one or more of the white box methods, and then supplement these test cases by applying black box methods to the modules specification
  • Once the test case is designed, the next step is to combine the module for testing. For this, the method used is either an Incremental or non-Incremental method.
  • Non-incremental method- all modules are tested independently. First, it combines all modules and then tests the whole program
  • Incremental method- each module is tested first and then gradually incremented to the tested collection. It does a step-wise retesting
  • In incremental Testing, there are two approaches — Top down and Bottom Up Testing
  • Execute the module with the selected data, requires a driver for supplying the test data, monitoring the execution, and capturing the results

Example Tips for Module Testing:

Here are a few tips to consider before performing Module Testing

  • Review test cases before using
  • Avoid confusion over the source of discrepancies
  • Use Automated Test tools
  • Examine variables that should be unchanged
  • To avoid self-tests swap modules
  • Re-use the test cases

Unit Testing vs Module Testing:

> Unit Testing:

  • Unit tests are a collection of tests written by a developer during the software development process
  • might be testing units in isolation

> Module Testing:

  • Module tests are a collection of tests written by a tester after some code has been written by a developer
  • Module testing might involve combining the unit’s test

Challenges in Module Testing:

So here we go with the top challenges in Module Testing

  • Non-incremental testing requires more work
  • Misunderstanding test doubles
  • Debugging test often
  • Need to understand the code

Conclusion:

  • In Software Engineering, Module testing (unit testing) is a process of testing the individual subprograms, subroutines, classes, or procedures in a program
  • The advantage of Module testing is that the probability of identifying errors or bugs in smaller chunks of the program becomes higher
  • For module testing method used is either an Incremental or non-Incremental method.

❤ ❤ Thanks for reading this article ❤❤

If I got something wrong? Let me know in the comments. I would love to improve.

Clap 👏 If this article helps you.


From Our Parent Company Aeologic

Aeologic Technologies is a leading AI-driven digital transformation company in India, helping businesses unlock growth with AI automation, IoT solutions, and custom web & mobile app development. We also specialize in AIDC solutions and technical manpower augmentation, offering end-to-end support from strategy and design to deployment and optimization.

Trusted across industries like manufacturing, healthcare, logistics, BFSI, and smart cities, Aeologic combines innovation with deep industry expertise to deliver future-ready solutions.

Feel free to connect with us:
And read more articles from FlutterDevs.com.

FlutterDevs team of Flutter developers to build high-quality and functionally-rich apps. Hire a Flutter developer for your cross-platform Flutter mobile app project on an hourly or full-time basis as per your requirement! For any flutter-related queries, you can connect with us on Facebook, GitHub, Twitter, and LinkedIn.

We welcome feedback and hope that you share what you’re working on using #FlutterDevs. We truly enjoy seeing how you use Flutter to build beautiful, interactive web experiences.

Need expert help building your Flutter app? Talk to FlutterExperts for architecture, development, and consulting support.