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.
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,
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:
>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:
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.
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.
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 fromFlutterDevs.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.
Wewelcome 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.
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
Arrange: Set up the necessary preconditions for the test. This may involve creating objects, setting up mock data, or performing other necessary setup tasks.
Act: Perform the action that you want to test. This could be calling a function, interacting with a widget, or performing some other action.
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:
Install the coverage package:
flutter pub add coverage
Run your tests with the coverage command:
flutter test --coverage
This will generate a coverage report in the coveragedirectory.
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:
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
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 fromFlutterDevs.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.
Wewelcome 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.
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.
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,clickhere.
> 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.
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.
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.
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 fromFlutterDevs.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.
Wewelcome 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.
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.
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.
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 fromFlutterDevs.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.
Wewelcome 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.
Cloud computing has become increasingly important in recent years because it allows for a wide range of tasks to be performed by programs. Web developers use various tools and languages to create impressive applications, making developer expertise essential in web and mobile app development. There are many options available in the field of cloud computing, including the ability to install and scale web and mobile apps, as well as monitor them. In recent years, there have been significant advancements in web and mobile development, and modern apps have more powerful capabilities. However, running a web or mobile app requires more than a hosting provider. Companies like Amazon and Google offer comprehensive solutions in this industry. An increasing number of developers and businesses are choosing serverless architectures, and in this article, I will compare Firebase and AWS to help your web development team determine the best option for your app.
Amazon Web Services (AWS) is a cloud computing platform that provides a wide range of services such as computing, storage, networking, database, analytics, machine learning, security, and application development. These services are designed to be highly scalable, flexible, and secure, and are delivered over the internet (the cloud) to businesses of all sizes, startups, and government agencies around the world.
AWS is a pay-as-you-go service, which means that you only pay for the services you use and there is no upfront cost or long-term commitment. You can easily scale up or down the resources you use depending on your needs, and you only pay for what you use. This makes AWS a cost-effective and flexible solution for businesses that need to access a wide range of computing resources.
Some of the popular services offered by AWS include Amazon EC2 (virtual servers in the cloud), Amazon S3 (object storage), Amazon RDS (managed relational databases), Amazon Lambda (serverless computing), and Amazon EKS (managed Kubernetes). AWS also offers a variety of tools and services for building, deploying, and managing applications, such as AWS CodePipeline, AWS CodeBuild, AWS CodeDeploy, and AWS CodeStar.
In addition to these core services, AWS also offers a range of services for networking, analytics, machine learning, security, and more. These services are designed to help businesses build, deploy, and run their applications and workloads in the cloud.
Merits of AWS:
Cost-effective: AWS offers a pay-as-you-go pricing model, which means you only pay for the services you use. This can be more cost-effective than buying and maintaining your hardware and infrastructure.
Scalability: AWS resources can be easily scaled up or down to meet changing demands, so you can quickly and easily allocate more resources as needed.
Reliability: AWS has a global infrastructure that is designed for high availability and can handle large amounts of traffic.
Security: AWS provides a wide range of security tools and features to help protect your data and applications, including encryption, identity and access management, and network security.
Flexibility: AWS offers a wide range of services and tools that can be easily integrated with your existing systems and applications.
Innovation: AWS is constantly introducing new services and features, which can help you stay up to date with the latest technologies and best practices.
Global presence: AWS has data centers located around the world, which means you can easily deploy your applications and services in multiple regions to provide low latency and high availability to your users.
Merits of AWS over Firebase:
Wide range of services: AWS offers a much wider range of services than Firebase, including computing, storage, networking, database, analytics, machine learning, security, and application development. This makes AWS a more comprehensive and flexible platform for building and deploying applications.
Customization: AWS allows you to customize and configure the resources you use, such as the operating system, network settings, and security policies. This can be useful if you have specific requirements or need to integrate with existing systems.
Integration with other AWS services: AWS integrates with a wide range of other AWS services, such as Amazon S3, Amazon RDS, and Amazon EKS, which can be useful for building more complex and scalable applications.
Greater control: With AWS, you have more control over the resources you use and how you use them. For example, you can choose which data centers to use, how to scale your resources, and how to manage access to your resources.
More mature platform: AWS has been around longer than Firebase and has a larger user base, which can make it easier to find documentation, community support, and third-party tools and services.
Demerits of AWS:
Cost: While AWS can be cost-effective compared to running your infrastructure, it can still be expensive, especially if you are using a large number of resources or if you have a lot of traffic.
Complexity: AWS has a large number of services and features, which can be overwhelming for new users. It can take time to learn how to use all of these services and to configure them to meet your needs.
Maintenance: While AWS takes care of the underlying infrastructure, you are still responsible for maintaining and managing the resources you use, such as installing patches and updates, and backing up your data.
Dependence on internet connectivity: AWS is a cloud-based platform, which means you need an internet connection to access your resources. This can be an issue if you are building applications that need to work offline or in low-connectivity environments.
Limited control: While AWS provides a lot of customization options, there are still some limits to what you can do. For example, you cannot directly control the underlying hardware or infrastructure, and you are subject to the terms of service and policies set by AWS.
Firebase:
Firebase has evolved from a Mobile-Backend-as-a-Service (MBaaS) platform into a comprehensive backend solution for mobile and web app development. Its services and tools allow you to quickly develop high-quality mobile and web apps without starting from scratch. Firebase is a collection of tools and software development kits (SDKs) that enable you to build, maintain, improve, and expand your apps across various mobile app development platforms, including web, iOS, and Android. Google Firebase also offers features such as file storage, analytics, identity authentication, real-time database, failure analytics, cloud storage, and push messaging. These services are generally hosted in the cloud. Firebase is a convenient cloud computing service that enables developers to connect their apps to APIs and backend cloud storage used by backend applications. Interestingly, Firebase was built on top of Google’s infrastructure. It provides SDKs for iOS, Android, and the web, making it particularly useful for front-end developers who want to build an app quickly without any backend expertise. You can also use a REST API to create a custom API.
Merits of Firebase:
Efficient Identity Verification and System Security : Google Firebase is a platform that offers complete protection for your systems through a range of security measures, including Google Sign-in, Chrome Password Manager, and Smart Lock. With these tools, Firebase ensures that your systems are secure and that user identities are verified and protected. Additionally, Firebase simplifies the sign-in process by providing a cross-platform identity solution that covers the entire spectrum of user authentication. Overall, Firebase is a reliable and comprehensive platform for securing and managing user identities.
Integrated Cloud Storage Solutions: Google Firebase provides a cloud storage solution that is optimized for fast and reliable uploads and downloads. It is designed to handle large volumes of user-generated content and offers easy access management options. With Firebase’s cloud storage, you can store, retrieve, and access your data quickly and efficiently, without worrying about data transfer speeds or access controls. Additionally, Firebase’s cloud storage is fully integrated with the rest of the Firebase platform, making it easy to use and manage alongside other Firebase features.
Streamlined Authentication Process: Google Firebase is a platform that allows developers to easily and quickly set up their authentication systems without the need for extensive coding. The platform provides a range of tools and resources that make it easy to implement authentication protocols and ensure the security of your application. With Firebase, you can set up your authentication system in a matter of minutes, saving you time and resources and allowing you to focus on other aspects of app development. Overall, Firebase is a powerful and efficient tool for managing and securing your authentication system.
Collaborative App Development with Firebase’s Real-Time Database: Firebase is a cloud-hosted NoSQL database that allows for the storage and synchronization of data in real time. This feature enables developers to access app data from any device and build powerful collaborative capabilities within their applications. Additionally, Firebase’s real-time database can be used to trigger the execution of backend code in response to events occurring within the database. This can be particularly useful for implementing real-time updates or automating tasks based on database activity.
Optimizing User Engagement with Firebase’s Device Tracking and BigQuery Integration Firebase is a platform that provides tools for tracking a user’s activity across multiple devices, including desktop computers, web browsers, mobile phones, and tablets. With Firebase, you can easily see how users interact with your app on different devices and make informed decisions about your app’s design and functionality. Additionally, Firebase includes features that make it easier to export data from Google Analytics to BigQuery, which can be useful for developers looking to better understand their users and engage more effectively with their audience.
Merits of Firebase over AWS:
Ease of use: Firebase offers a simple and intuitive interface that makes it easy for developers to get started quickly. It also provides a variety of ready-to-use features and integrations that can be easily added to a project.
Real-time updates: Firebase allows developers to build real-time applications that can update data in real-time across all connected clients. This can be especially useful for applications that require fast, bidirectional communication, such as chat or gaming applications.
Pricing: Firebase offers a flexible pricing model that allows developers to pay only for the resources they use. This can be more cost-effective than some of the fixed-price options offered by AWS.
Integration with Google Cloud Platform: Firebase is fully integrated with the Google Cloud Platform, which means developers can use other Google services, such as BigQuery and Cloud Functions, in conjunction with Firebase.
Demerits of Firebase:
Limited control: Firebase is a managed service, which means that developers do not have full control over the underlying infrastructure. This can make it more difficult to customize the platform to fit specific needs.
Limited scalability: Firebase is designed to be easy to use and get started with, but it may not be the most scalable option for very large applications. Developers may need to consider other options, such as AWS if they need to scale to millions of users.
Lack of support for certain workloads: Firebase is not suitable for all types of workloads. For example, it does not offer support for batch processing or high-performance computing.
Vendor lock-in: Firebase is a proprietary platform, which means that developers are locked into using Google’s services. This can make it more difficult to switch to a different platform in the future if the need arises.
Comparison between Firebase and AWS:
Services Firebase: Firebase provides several tools and services for building, scaling, and managing applications, including a real-time database, cloud storage, authentication, hosting, analytics, and push notifications. AWS: AWS offers a much wider range of services, including computing, storage, networking, database, analytics, machine learning, security, and application development.
Customization Firebase: Firebase provides some customization options, such as the ability to customize the database rules and the ability to add custom domains to your hosting site. AWS: AWS allows you to customize and configure the resources you use, such as the operating system, network settings, and security policies.
Integration Firebase: Firebase integrates with other Google services, such as AdMob and Google Ads, which can be useful for monetizing and marketing your application. AWS: AWS integrates with a wide range of other AWS services, such as Amazon S3, Amazon RDS, and Amazon EKS, which can be useful for building more complex and scalable applications.
Control Firebase: Firebase provides several tools and features to help you manage and monitor your application, but you have limited control over the underlying infrastructure. AWS: With AWS, you have more control over the resources you use and how you use them. You can choose which data centers to use, how to scale your resources, and how to manage access to your resources.
Cost Firebase: Firebase is generally less expensive than AWS, especially for small applications. However, as your usage increases, the cost can start to become comparable to AWS. AWS: AWS is a pay-as-you-go service, which means you only pay for the resources you use. This can be more cost-effective than buying and maintaining your hardware and infrastructure, but it can still be expensive, especially if you are using a large number of resources or if you have a lot of traffic.
Learning curve Firebase: Firebase has a relatively shallow learning curve, with intuitive tools and features that are easy to use and get started with. AWS: AWS has a steeper learning curve, with a large number of services and features that can be overwhelming for new users. It can take time to learn how to use all of these services and to configure them to meet your needs.
Conclusion: Firebase or AWS, what to choose?
As already said above, Firebase is a managed service that offers a simple and intuitive interface, making it easy for developers to get started quickly. It is well-suited for real-time applications that require fast, bidirectional communication, such as chat or gaming apps. Firebase also offers a flexible pricing model and is fully integrated with the Google Cloud Platform, allowing developers to use other Google services in conjunction with Firebase.
However, Firebase has some limitations to be aware of. It does not offer full control over the underlying infrastructure, so it may not be as customizable as some other platforms. It may not be the most scalable option for very large applications and does not support certain types of workloads, such as batch processing or high-performance computing. In addition, Firebase is a proprietary platform, which means that developers are locked into using Google’s services and may have difficulty switching to a different platform in the future.
On the other hand, AWS is a comprehensive cloud computing platform that offers a wide range of services and robust infrastructure. It is highly scalable and can support millions of users. AWS is also well-suited for a variety of workloads, including batch processing and high-performance computing. However, it may be more complex to set up and use than Firebase, and it may have higher upfront costs due to its fixed-price pricing model.
Ultimately, the best choice will depend on your specific needs and requirements. It is important to carefully evaluate your options and consider consulting with a cloud computing expert to help you make the right decision.
Thanks for reading this article. If I got something wrong? Let me know in the comments. I would love to improve.
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 fromFlutterDevs.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.
Wewelcome 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.
A parallax scrolling effect is attained by pushing the background image very slightly toward the opposite direction of the whole list. Let’s know more about it.
Parallax scrolling is a website technique where we make our background move at a little slower pace than the foreground we make. This is a 3D effect as the user scrolls down the site, putting in a sense of depth and forming a more mesmeric experience while browsing.
Our eyes recognize objects close to us comparatively larger than those far away from our eyes. We perceive distant objects as if they are moving very slowly. Parallax bounds the same idea as human eyes which is a so-called optical illusion.
Flutter makes it very easy to implement the parallax effect in our apps by using a few widgets, such as Stack, Positioned, etc. We’re going to use Stack and Positioned widget in the demo project below. With the help of flutter widgets here we quickly can implement parallax scrolling.
What is a Stack widget?
It is a widget in Flutter SDK which allows us to make layers of widgets by putting one over the other.
This class is significant if you want to overlap several children simply. It is like putting objects in a single bucket one after the other(First goes in, last comes out). Similarly, if we assemble the same example pattern in a flutter, we could imagine having a few texts and an image, overlaid with a gradient and an elevated button attached at the bottom.
It gets mixed very smoothly and makes the UI much more interactive than before.
We’re also using the Positioned widget in this. Positioned widget is a widget that controls where a child of a Stack widget is going to be positioned. For example :
Here Positioned widget is for setting the fixed position of the child, i.e., the ClipRRect widget. For this, we’d be using named parameters such as top, bottom, left, right, etc. In the above example, bottom: 20 and left: 20 parameters are being used which means the child widget will be positioned this much distance from the left and bottom of the stack. Then the other parameters will occupy the rest of the distance (from top and right).
In the further demo project, we’ll be dealing with ListViewwidgetas our Scrollable. ListView widget is the most commonly used ScrollView widget where its children get displayed one after another in the scroll direction.
Role of ListView in our demo:
In our project, the ListView widget that has a child of a Container widget is going to be responsible to form the background for all the further children of Stack
Here ParallaxText() is a constructor of a Custom widget made for the arrangement of texts over the screen(as they internally contain Positioned widgets). Similarly, the ParallaxImage() is a constructor of a Custom widget that will be responsible for the arrangement of Images over the screen.
ParallaxText.dart
class ParallaxText extends StatelessWidget{
const ParallaxText({
Key? key,
required this.left,
required this.top,
required this.text,
required this.colour,
}) : super(key: key);
final double left;
final double top;
final String text;
final Color colour;
@override
Widget build(BuildContext context) {
return Positioned(
left: left,
top: top,
child: Text(text, style: TextStyle(color: colour, fontWeight: FontWeight.w900, fontSize: 60.0, fontFamily:"Helvetica")
),
);
}
}
Here, the Positioned widget helps its child to get positioned over the stack according to the parameters it’s receiving.
When we run the application, we ought to get the screen’s output like the underneath screen video.
Final Output
Conclusion:
In this article, we’ve learned how to display a list of parallax scrolling images/texts. Now you can try it in your project and make it more fun to work with.
❤ ❤ Thanks for reading this article ❤❤
If I got something wrong? Let me know in the comments. I would love to improve.
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 fromFlutterDevs.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! You can connect with us on Facebook, GitHub, Twitter, and LinkedIn for any flutter-related queries.
Wewelcome 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.
The goal of the go_router package is to simplify the use of the Router in Flutter as specified by the MaterialApp.router constructor. By default, it requires an implementation of the Router Delegate and Route Information Parser classes. These two implementations themselves imply the definition of a custom type to hold the app state that drives the creation of the Navigator. You can read an excellent blog post on these requirements on Medium. This separation of responsibilities allows the Flutter developer to implement several routing and navigation policies at the cost of complexity.
Add Dependency:
Open the terminal in your Flutter project. Then run the following command to install the go_router package in your Flutter Project.$ flutter pub add go_router
or you will add this line to your package’s pubspec. ymal file and run “flutter pub get”
dependencies: go_router: ^6.0.1
Features:
GoRouter has many features:-
> Parsing path and query parameters using a template syntax (for example, “user/:id’).
> Displaying multiple screens for a destination (sub-routes).
> Redirection support — you can re-route the user to a different URL based on application state, for example to a sign-in when the user is not authenticated.
> Backwards compatibility with Navigator API
> Support for both Material and Cupertino apps
Implementation:
Hello Everyone…!!!! Today we learn about routing in the flutter application. To integrate go_router in your app first you have to add MaterialApp.router in the place of the MaterialApp. This constructor accepts many properties like routeInformationParser, routerDelegate, etc.
After that, we create an app_route_config.dart. In this file, we pass all the routes. First, we add the default route which is the home page. In routes, we add a name, path ad pageBuilder. After that, we create a route for the profile page in which we pass the userId and userName. And we also create GoRoute for the about page and contact us page.
And also add errorPageBuilder in which we return MaterialPage and pass ErrorPage as a child. and return the router. This is how we create the routes for navigators.
We also create the route constants for GoRouters. In which we pass all the routes as a string.
At last, we create the UI of the project and in the UI part, we also learn the go_router and how to navigate the UI. In-home. dart we return the scaffold and pass the appbar in which we pass the title. Pass the Column in the body and add the buttons by which we navigate from one screen to another screen.
We can navigate in many ways like push, pushNamed in which we pass the params like userName and UserId or we can directly pass the path of the route which we already defined in the route_config.dart file. This is how we use go_router. I hope you learn many things like how to create paths or routes and how to pass params easily.
In this article, we learn how to implement go_router in Flutter Application. We learn many things like how to create the config file and how to pass params to another screen and many things.
❤ 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 Navigate With GoRouter In Flutter:
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 fromFlutterDevs.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 Facebook, GitHub, Twitter, and LinkedIn.
Wewelcome 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.
These days we see several times that as we approach getting signed-in in many applications we need to verify our phone numbers. Although, we can do so in mainly two ways, either by making a phone call or by an OTP — sent as sms to our phone numbers.
So along with that, we have also noticed, that the OTP whichcomes with the sms got filled up automatically in the OTP fields which makes UI more user-friendly. Well, how does that happen? I’m going to answer the question with the help of this article along with my demo project.
In this session, we’d be using the most commonly used package for such purposes, that is sms_autofill.
Working with this package made it comparatively easier and faster to get my expected output. We just need to follow a few steps to make it work properly throughout our project which we’ll discuss later in this article.
To get the OTP sms, I’ve used Firebase Phone Authentication. To achieve that we first need to create a Firebase project in Firebase Console. Once you have created one, make sure that you enable the Phone sign-in method in the Authentication section.
Firebase Phone Authentication:-
Here’s how we do it:-
To know more, you may go to the Apple, Android, or web options according to the project environment in which you build the project. For me it was Android.
Save it as you enable it. It will look like this
Now firstly, we need to send an OTP sms to the entered mobile number.
Here, we’ll pass the phone number (fetched by the TextEditingController) to the phone argument of this function.
We used Future<String> as the return type because we are going to return the verification ID that we get during the process of sending OTP. Further, this verification ID will be needed in the OTP screen.
This is a snippet from the OtpScreen.dart where we are using the verification ID we extracted from CommonUtils.firebasePhoneAuth() method. Along with that, we pass our smsCodereceived. It then matches OTP which was sent and the OTP which is being passed in smsCodealong with the verification ID. If they match, we successfully will be authorized to get through the other page (HomeScreen.dart).
OTP Autofill:-
Now let’s get through the steps to implement otp-auto-filling
Import the latest version of the sms_autofill package in pubspec.yaml file
dependencies: sms_autofill: ^2.2.0
Go to >android >app >build.gradle file and change minSdkVersion from 16 to 19
defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.otp_autofill_demo" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. minSdkVersion 19 targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName }
Add listner listenForCode() method inside initState() method to listen otp sms as soon as possible.
Use the PinFieldAutoFill() widget as our OTP field. You can apply decoration to it to make it more attracting. I’ve used BoxLooseDecoration() constructor to decorate fields.
Override dispose() method to unregister stream listener. This is a very significant step as the stream should be closed once we’re done using it. Otherwise, we could face memory leakage problem.
As we run the application, this is what we get as our final output.
Conclusion:-
In this article, we’ve learned how to autofill OTP from OTP sms. Moreover, we also got to know about Firebase Phone Authentication and implemented it in the project.
❤ ❤ Thanks for reading this article ❤❤
If I got something wrong? Let me know in the comments. I would love to improve.
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 fromFlutterDevs.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.
Wewelcome 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.
The Flame Engine aims to provide a complete set of solutions for most of the common problems that games developer might face in the flutter environment.
This article will deliver a quality introduction to the Flutter Flame game engine. You’ll learn how to build a Flutter Flame game, load sprites, and add animations. In the further project, we shall talk about animations made with Flutter Flame.
Flutter is an open-source framework created by Google where we craft various attractive applications for the Android, iOS, web, etc platforms from a single code base. Flutteruses a client-optimized language called Dart that makes faster apps on any platform. It is a much easier approach than traditional methods.
Flutter makes it easy to develop beautiful, interactive, and user-friendly interfaces(UI). Although, Flutter is a framework that is used for both frontend and backend development. But because of its adorable performance in frontend developers mostly use Flutter for Frontend development.
The Flutter team is dedicated to providing the ability to all kinds of developers to build applications in a minimal amount of time and release them effortlessly. For instance, Game developers are now capable of crafting beautiful game apps without taking care of performance issues, load times, and app sizes problems.
Flame:
It is a 2D game engine by which we develop various 2D game applications that run on top of flutter. We get so many useful & amazing features of it such as
Game loop
A component/object system(Flame Component System(FCS))
Collision detection
Images, sprites, sprite sheets, and animations.
Input/gestures handling
General utilities that make development easier.
Installation:-
Initially, you need to install Flame to implement it in your project. For that, we need to add its package with the latest version of it in pubspec.yaml file:
dependencies: flame: ^1.6.0
Code Implementation:-
To attach a Game instance in our Flutter tree, we need to give the charge to the widget called GameWidget. Or in simpler words, we will wrap our game with GameWidget at initials.
Here Game() is the game instance that GameWidget() will render over the screen. “Game” extends the FlameGameclass.
class Game extends FlameGame with HasTappables { @override Future<void>? onLoad() { super.onLoad(); }
FlameGame is a more absolute and opinionated implementation of Game. Extending it makes the developer able to add his game logic or he can keep the logic in the child Component.
FlameGame is based on the Flame Component System (also called FCS). This is the base class mostly recommended to use for most games that are made with Flame.
Component:
Everything we see on top of the screen is all components. For instance, background image, all the characters/objects on the screen, etc.
All components get inherited from the abstract class Component directly or indirectly.
Every Component has a few methods that you can implement optionally while using FlameGame the class. If you are not using FlameGame, you can implement these methods on your game loop if you need.
Few generally used components:
PositionalComponent — This class represents a positioned object over the screen, which could be a floating rectangle or a rotating sprite.
SpriteAnimationComponent — This class is used to represent sprites containing Components that run in a single cyclic animation. I’ll be using it in the further project file for the animation making.
You can download sprite sheets and make your animation UI. Few are here.
Final Output:-
When we run the application, we ought to get the screen’s output like the underneath screen video.
As we click the DialogButton component, we are changing the sprite sheet limits from 0–11(running state) to 12–18(sitting state).
Conclusion:-
In this article, we’ve learned how to work will package flameto encounter animation in our application. We commonly use this package for developing 2D games but it’s indeed a good choice for the making of animations too in our applications.
❤ ❤ Thanks for reading this article ❤❤
If I got something wrong? Let me know in the comments. I would love to improve.
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 fromFlutterDevs.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.
Wewelcome 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.
State management is one of the most important aspects of app development. In a large and complex application, keeping track of the state of different widgets and managing the flow of data can quickly become a challenging task. This is where Redux comes in.
Redux is a state management library that is widely used in React and React Native applications. It is also a popular choice for state management in Flutter, a UI toolkit for building natively compiled applications for mobile, web, and desktop.
It provides a centralized store for storing the state of an application, and it follows the unidirectional data flow pattern. In Flutter, Redux can be used to manage the state of an application, making it easier to understand, maintain, and scale.
In this blog, we’ll explore how to integrate Redux into a Flutter application and understand the key concepts of Redux.
Redux is a predictable state management library that is based on the principles of Flux architecture. It is designed to make it easy to manage the state of an application in a centralized and consistent way. The core concepts of Redux are:
State:The state of an application is the data that changes over time, such as user data, API responses, or UI state.
Actions:Actions are events that are dispatched from the view layer to modify the state of the application. Actions have a type and can also have payload data.
Reducer:The reducer is a pure function that takes the current state and an action as inputs and returns the updated state. The reducer defines how the state should be updated based on the action type.
Store:The store is the central place where the state of the application is stored. The store is created by passing the reducer function to it.
By following these core concepts, Redux makes it easy to manage the state of an application consistently and predictably.
Why use Redux in Flutter?
Flutter provides a rich set of built-in widgets and tools for building complex UIs. However, as the size and complexity of a Flutter application grow, it becomes more challenging to manage the state of the application. This is where Redux comes in. By using Redux, you can centralize the state of your application and make it easier to manage.
Some of the benefits of using Redux in Flutter are:
Predictable state management: With Redux, the state of the application is managed in a centralized and consistent way. This makes it easier to understand how the state changes over time and debug any issues that may arise.
Scalability: As the size and complexity of a Flutter application grows, Redux makes it easier to manage the state of the application. By following the core concepts of Redux, you can quickly scale the state management of your application.
Reusable code:By centralizing the state of the application, you can write reusable code that can be shared across different parts of the application.
Easy to test:Because the reducer is a pure function, it is easy to write automated tests. This makes it easier to ensure that the state of the application is being updated correctly
Integrating Redux into a Flutter application:
In Flutter, there are several packages available for implementing Redux, such as flutter_reduxand redux_thunk. To get started with Redux in Flutter, you need to install the flutter_reduxpackage and create a store for your application.
dependencies: flutter_redux: ^7.0.0
The store is created using the createStore() function, which takes the initial state of the store and a reducer as arguments. The initial state is a plain Dart object, and the reducer is a Dart function that takes the store’s current state and action and returns the next state of the store.
Define your application state and action:
class AppState {
int counter;
AppState({this.counter = 0});
}
enum Actions { incrementCounter }
final store = Store<AppState>( appReducer, initialState: AppState(), );
Once the store is created, you can use the StoreProvider widget to provide the store to the rest of the application. The StoreProvider widget takes the store and a child widget as arguments, and it makes the store available to the child widget and all its descendants.
4. Use the StoreProvider widget to provide the store to your application:
In the child widget, you can use the StoreBuilder widget to access the state of the store. The StoreBuilder widget takes a builder function as an argument, which takes the store and returns a widget. The builder function is called whenever the state of the store changes, and it returns the updated UI.
5. Use the StoreBuilder widget to access the state of the store in a widget:
This example demonstrates a basic integration of Redux in a Flutter app. The example shows how to create the store, provide it to the application, access the state of the store, and dispatch actions to update the state.
Note: This is just a basic example to get you started with Redux in Flutter. You can extend and customize it to fit your needs.
Conclusion:
Redux is a powerful state management library that can simplify the state management of a Flutter application. By using Redux, you can keep the state of your application in a single store, and you can manage the flow of data using actions and reducers. With its simple approach, Redux can help you build large and complex Flutter applications with ease.
❤ ❤ Thanks for reading this article ❤❤
If I got something wrong? Let me know in the comments. I would love to improve.
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 fromFlutterDevs.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! You can connect with us on Facebook, GitHub, Twitter, and LinkedIn for any flutter-related queries.
Wewelcome 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.