Google search engine
Home Blog Page 63

Flutter 2.10 — What’s New In Flutter

0

For a few years, Google has been developing Flutter and aspires to create the cross-platform software framework of the developers’ vision. The all-new ​​​Flutter 2.10 is now available, and it covers some exciting new features!

Hello everyone finally here is Flutter 2.10 which is Flutter’s stable version. This version brings big updates to Flutter support for windows. Google has been developing Flutter to build cross-platform software for developers for the past decagon. 85% of developers must know how to hold Flutter, and now they are looking for the next updates.


Table Of Contents:

Windows is now ready for production apps

Web App Updates

Android Updates

IOS Updates

Flutter SDK

Performance Enhancements

Material 3

Enhancements to integration testing

Flutter Dev Tools

Conclusions


Windows is now ready for production apps:

In the Flutter 2.10 release, there is no longer a requirement to flip an interchange. Of course, it easily coalesces well with Windows support. The new version quickly generates the Windows app on Flutter stable channel

This version contains significant improvements to text handling, keyboard handling, keyboard shortcuts, and new integrations directly into Windows, including support for command-line arguments, globalized text entry, and accessibility.


Web App Updates:

This release also has many updates in web developments. For example in previous releases, scrolling to the extremity of a multi-line Text-field on the web did not work congruously.

Edge scrolling for text selection is instigated in this release: when the selection stirs outside of the text field, the field scrolls to show the scroll comprehensiveness. This new functionality is convenient in both web and desktop apps. In inclusion, this Flutter release includes another notable web refinement.


Android Updates:

The new release of Flutter 2.10 has refinement for Android users as well. If the developers fabricate a new app, the Flutter release automatically supports the new release 12. The Flutter 2.10 enables multiplex support with automatic release as well.
The flutter tool gives a high-end intent to those steps into slight support. It provides increased carry for the Android SDK genre with new logs. In a current report, 76% of Android users must know about the Flutter app development.


IOS Updates:

Inclusion to performance advance, we’ve also added some platform-specific features and improvements. One new improvement is smoother keyboard animations in iOS from luckysmg, which is bestowed automatically to your app without you having to do a thing.

In inclusion to this, the Flutter app development company will update Flutter for iOS users. They will update iOS using the new version of the Flutter 2.10 platform. Developers can get 64-bit iOS architecture to obtain unique features.


Flutter SDK:

Utilizing Flutter DevTools takes new steps to assess the features. In inclusion to this, it locates updated features. It utilizes the latest release and latest move to dart DevTools for suitable version options. Using Pub global actuate seems to be an essential part of development in 95% cutting border solutions.

On the other hand, the Flutter DevTools uses overturn as the flag and contemplates extensive advance. It will change towards keyboard shortcuts and maximize the sake. The combination works directly with Windows and braces command-line arguments.


Performance Enhancements:

There is undeviating region management. The new version is relevant on iOS and metal for fragmentary configuration. There is a swap in 90th and 99th percentile rasterization. The immensity of gauge and GPU integration is a must heed in the new release. It creates a magnificent benchmark and takes more than 90% of the developer’s first.

In profile and release manner, Dart code is compiled forward of time to native machine code. The clue to the organization and compact size of this code is a whole program type glide analysis that unlocks many compilers amendments and hostile tree-shaking. However, as the type flow inspection must cover the whole program, it can be somewhat expensive.


Material 3:

This version marks the start of the Material 3 transition, which encompasses generating an entire color strategy from a single seed color. You can generate an occasion of the new ColorScheme type with any color. This version also adds ThemeData. The use of Material 3 flag source components to adopt the new Material 3 appearance.

There are also 1,028 new Material icons.


Enhancements to integration testing:

The integration testing works successfully and depends on the Flutter SDK by definition. The integration testing is reasonable and gets into new attributes as well. It gives an impressive blend and considers the flutter driver package with an absolute solution.


Flutter Dev Tools:

employ Flutter DevTools takes a new pace to evaluate the features. In inclusion to this, it discovers updated traits. It utilizes the latest release and new move to dart DevTools for suitable version options. Using Pub global actuateseems to be an integral part of development in 95% cutting edge suspension.


Conclusion:

In this article, we have been through What is new in Flutter 2.10 version. You can learn new things through this article, apply them to your project and make your project fast and easy.


❤ ❤ 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! 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.

Theme Switching with Bloc and RxDart In Flutter

0

Themes, are a topic people often talk about while making apps the most commonly used term regarding this topic would be ‘dark theme’, You can often see people asking how to manage a dark theme in your application or even going as far as asking how to manage different icons for different themes.

One such incident of managing themes happened to me when I was asked to manage 2 separate theme modes based on user preferences. So, I would like to share with everyone how I managed it at that time, hope everyone enjoys following along.



First things first let me brief you about this a little, In this, we will be managing 2 themes first one will be ‘red’ and the second one is called ‘blue’. On user selection the theme would completely change on every screen even icons and background images, So to further progress with this I suggest making 2 folders.

We are going to name the first folder as Red and the second one Blue respectively and put all our icons and background images inside of them.

Now we are done with the basic setup, it’s time to move on to the coding part of it. First of all, we will create an enum that will help us manage our themes

enum Mode { red, blue }

Alright, now we will work on our stream part for this. First of all, we will create a new file and call it theme_bloc_state.dart

part of 'theme_bloc_cubit.dart';

abstract class ThemeSwitchBloc {}

class ThemeInitial extends ThemeSwitchBloc {}

Secondly, we will create the theme_bloc_cubit.dart file

import 'dart:async';

import 'package:bloc/bloc.dart';

part 'theme_bloc_state.dart';

class ThemeBlocCubit extends Cubit<ThemeSwitchBloc> {
ThemeBlocCubit() : super(ThemeInitial());

final _themeController = BehaviorSubject<Mode>();

Stream<Mode> get themeStream => _themeController.stream;

dynamic switchTheme(Mode mode) async {
if (mode != Mode.red) {
_themeController.sink.add(mode);
return Mode.friendship;
} else {
_themeController.sink.add(mode);
return Mode.blue;
}
}

}

Note: You can learn more about behavior subjects over here

Moving onto, now we will be looking at switching the theme itself, but before that, we got to create a function that will return to us the current theme’s colors and the current theme’s icons path

So we will create 2 globally accessible functions inside our UiHelper class

Function 1 :

static Color getColor({
required Mode? themeMode,
}) {
var _color = Colors.red;
switch (themeMode) {
case Mode.blue:
_color = Colors.blue;
break;
case Mode.red:
_color = Colors.red;
break;
default:
break;
}
return _color;

}

This function will return to us the color for the theme, you can create even more functions that go into even more details as to what you may need

Function 2 :

static String getThemeIconPath({
required Mode? mode,
required String iconName,
}) {
var _iconPath = 'assets/red/';
if (mode != null) {
switch (mode) {
case Mode.blue:
_iconPath = 'assets/blue/';
break;
case Mode.red:
_iconPath = 'assets/red/';
break;

default:
break;
}
}
_iconPath = _iconPath + iconName;
return _iconPath;
}

The second function returns us the path for a particular icon. With this, we are now set to start with our changing of the theme. So, here is the shortcode for setting up a way to change the theme, I am using radio buttons for this :

var _radioSelected = Mode.red;StreamBuilder(
stream: _themeCubit?.themeStream,
builder: (context, snapshot) {
return Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Radio(
value: Mode.red,
groupValue: _radioSelected,
activeColor: Colors.blue,
onChanged: (dynamic value) async {
_changedOptions(value);
},
),
Text('Red'),
],
),
Row(
children: [
Radio(
value: Mode.blue,
groupValue: _radioSelected,
activeColor: Colors.blue,
onChanged: (dynamic value) async {
_changedOptions(value);
},
),
Text('Blue'),
],
),
Container(),
],
);
}),

The basic working is that when you click on the radio button, it will now update the value of our themeStream and similarly update the value of _radioSelected, which will allow new values to be returned in our getColor and getThemeIconPath functions.

The function to do so is:

void _changedOptions(value) async {
_radioSelected = _themeCubit?.switchTheme(value);
_radioSelected = value;
}

With this, we can finally change the theme whenever we want, now to look at the effect of theme changing we once again have to use a stream builder to read our from our stream :

StreamBuilder<Mode>(
stream: _themeCubit?.themeStream,
builder: (context, snapshot) {
return Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 20),
color: UIHelper.getColor(themeMode: snapshot.data),
child: Center(
child: Image.asset(UIHelper.getThemeIconPath(
mode: snapshot.data,
iconName: IconConstants.alarm),),
),
);
})

With this we can see the color changing, as every time we will switch the theme, it will return the new icon path and the new color, the default values are taken in the UiHelper function to make sure a value is always returned and we never encounter a null value.

This was but a simple example of how switching themes with rxDart and Bloc Cubit works if your objective was to change even the icons on the flip of a switch this method certainly works.

If you are facing any problems in the future implementing this, feel free to reach out to me, I would be happy to help.

I know this tutorial was a short one but it felt refreshing to come up with a way when someone asked me how do I change all the icons in an app with the flip of a button, I enjoyed implementing and writing about it, I hope everyone reading this also enjoys implementing it, If there are some better ways to achieve the same available please do let me know of those as well, I would love to look into them.


❤ ❤ 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! 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.

Automation Testing In Flutter

0

Mobile phones and mobile applications — both are booming in this present reality. Having the force of a PC in your pocket is progressive. According to Statista, mobile accounts for the greater part of the web traffic around the world. Mobile phones (barring tablets) added to 54.4 percent of worldwide site traffic in the final quarter of 2021, expanding reliably over the recent years.

Source

As simple as it has been to record a mobile application’s advantages in the present web-driven world, it has not been that straightforward in creating one. Worldwide, mobile phones are driven by Android and iOS. Together they might run over close to 99% of the mobile phones yet their fundamental application development architecture is entirely different.

Flutter is a unique mobile application development toolkit (although it upholds desktop OS). The toolkit compartment has been an uncommon hit as it advances code once and runs on any stage. It cuts down development costs, maintenance costs, and testing costs with time extending to a lower level.

Developers evaluated it and acknowledged it with great affection. With the project count increasing, Flutter testing has turned into a critical and mindful work. This post on testing Flutter applications takes you around a similar theme exploring Flutter, its fundamentals, and Flutter testing in the most productive way.


Table Of Contents:

What is Flutter?

Why use flutter?

Why flutter testing is important?

How to test flutter Applications?

Flutter Testing Manually On Real Device Cloud

Flutter Testing Using FlutterDriver

Flutter Testing Using Automation On Real Device Cloud

Conclusion


What is Flutter?:

Flutter is an open-source framework created by Google to back out the course of mobile application development and work with the code reuse policy. Flutter runs on the standard of cross-program testing development. In this manner, a single code unit can be incorporated for different stages like Android, iOS, Linux, Windows, and macOS.

Flutter is by all an incredible fanatic of widget-based development. It gives reusable code components, for example, buttons and sliders for simple customizations as indicated by the project needs. The second mainstay of the Flutter structure is the SDK (Software Development Kit) which assembles the code as indicated by operating system like Android and iOS. Alongside these two unequivocal and strong qualities, every one of the connected highlights, for example, time-saving, and cost-cutting, come into the image.

Why use Flutter?:

I’m certain you more likely than not got a thought at this point about the advantages of involving Flutter as a development framework. To sum up, the framework offers the accompanying things of real value:

  • > Cross-platform application development framework.
  • > Brings out a fast application.
  • > Open-source platform and therefore tons of contributions from people who hear what you want to say.
  • > Flutter uses darts. If you are familiar with the language, it might become a de-facto choice for you.
  • > Flutter also comes with excellent IDE support. IntelliJ, Emacs, VSCode, and Android Studio all support Flutter development.
  • > The framework is often appraised for its exhaustive official documentation.
  • > It might have been just four and a half years since the release of Flutter, but it offers a very vast community.
  • > Flutter has topped the charts as the most used cross-platform software development framework. The strong growth shows a promising future, and if you are looking to learn something new, Flutter could be the best choice.

The above image shows the growth rate of cross-platform frameworks in three consecutive years.

Why Flutter Testing is Important:

For high-quality, scalable Flutter applications, testing is one vital basic region. Most teams and developers have a solid comprehension of the significance of testing yet frequently miss the mark on the experience of writing great tests, when to write, and where to write.

A good testing system guarantees that current assumptions and presumptions are met and increments trust in the product. With such countless products utilizing flutter, testing is significantly more vital to guarantee that the code we write now will in any case work appropriately regardless of the number of features we add or the number of developers we onboard to the project.

How to test Flutter applications:

At this point, we are persuaded that Flutter applications are not difficult to create, and with the advantages it offers, it is generally on the shortlist before beginning another project. Yet, is it a similar case with Flutter testing based on applications?

In Flutter testing, we have two methods:

  • > Manual testing for things such as UI, experience, widget compositions, and so forth.
  • > Automation testing for checking the usefulness of utilizing different sorts of data and activities on the applications. On the off chance that you are searching for a cloud-based solution, LambdaTest can fill the two needs in a single stage which is generally prescribed to work swiftly

Flutter Testing Manually On Real Device Cloud:

The Real device could be viewed as perhaps the most ideal decision for mobile application testing when contrasted with testing on emulators and test systems. It doesn’t cost as much as building another genuine device lab and gives us precise outcomes for the tests. Cloud-based applications have a variety of emulators for mobile applications yet as a tester, attempt to favor the real gadget cloud.

  • > Starting in Any application first we have to create test cases and evidence for the app.
  • > Then log in to the Traffic Sentinel App.
  • > Check home screen is available or not.
  • > Click on the Report offense icon then the report offense screen is visible.
  • > Check whether video and photo icons working or not.
  • > Clicking on send icon functionality working or not.
  • > Clicking on Reported offense, then In progress data should be visible.
  • > Check functionality of both IOS and Android.
  • > If both devices working fine. Confirm Developer for the same.

Flutter Testing Using FlutterDriver:

Flutter testing is genuinely simple to implement, particularly while utilizing the FlutterDriver expansion. FlutterDriver is an augmentation given by the flutter_driver package for integration testing Flutter applications on real devices and emulators.

By utilizing the Flutter Driver expansion, we can run tests written in Dart and obtain brings about a machine-readable format. Flutter Driver associates with an application and drives it like a user would, collaborating with the widgets within it. This permits us to test our applications completely, including edge cases that might be challenging to reach the hard way. You can write unit tests with flutter_test, widget_test, and integration tests with the Flutter Driver extension.

Flutter Driver is like Selenium WebDriver. Automating the Flutter UI and running it against real devices or emulators is utilized. The benefit of utilizing Flutter Driver is that we can automate our testing utilizing a particular stage like Android Studio or through the command line.

Flutter Testing Using Automation On Real Device Cloud:

Using Appium as the go-to automation is a good decision for testing tools for automation testers. The issue is only the device cloud that they need to have and keep up with in-house for such a long-distance race. Real device cloud supporting Appium can be an achievable decision that can wrap up your application test automation quicker than you can expect.

Automation gives an Appium Grid to mobile testing with real devices at their end. Along these lines, you can decrease your test execution time by 10x and coordinate CI/CD advances on a similar pipeline. Moreover, covering all tests in a single spot gives you to coordinate and keep up with test information and results for better examination. In Automation, we need to run data in an automated tool environment utilizing an emulator or test system.

Conclusion:

Flutter was released as a steady form in 2018. In such a brief time frame, this is how Flutter’s utilization diagram moved around the same year.

It is today one of the most involved systems for mobile application development, and according to my experience, simply two things trait to this achievement. First is the widget-based development, which is a huge hit as developers can handle their components. Furthermore, the capacity to write once and develop applications for Android and iOS together is a huge selling point in the software industry. You save on time and costs and simply keep one codebase. Furthermore, it is quick, light, and gives a rich UI to the application.

Today many companies use Flutter in their application advancement and delivery of the application to a large number of users. Be that as it may, your application venture doesn’t end here. No application is finished without testing and checking its usefulness before delivery. This guarantees great quality and great feedback from the user. The prescribed method to test your Flutter applications is utilizing a cloud-based solution with one or the other manual or remote methods.


❤ ❤ 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! 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.

Implement GraphQL with Flutter

0

GraphQL is a query language, which is used for API. It allows the client to exact data they need from the server(API), With the help of a query, we exact the specific data or component from the server. GraphQL is designed to make APIs pliable and suitable to use so that they are easier to develop. GraphQL helps you to build complex apps.


Table Of Contents:

What is GraphQL

Add Dependency

Usage of GraphQL

Conclusion

GitHub Link


What is GraphQL:-

GraphQL has many edges compared to REST. Rather than using a fixed data structure approach, GraphQL requests specific data the client requires. REST retaliation is notorious for holding too much data or not enough. GraphQL deciphers this by fetching exact data in a single request. GraphQL also has an introversion feature that allows developers to check types & the schema to secure they’re querying for data the right way.


Add Dependency:-

In your project goes to the pubspec. yaml and add the dependencies under the dependencies: add the latest version of graphql_flutter.

dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
graphql_flutter: ^5.1.0

Usage of GraphQL:-

GraphQL is very useful for any flutter project who have complex APIs. It is an easy way to fetch the exact data from any Server(API).

GraphQLClient:

For fetching the data first we need to create a client for connecting to the server(API). To connect to the server we use GraphQLClient. GraphQLClient has two required properties cache and link.

final HttpLink httpLink =
HttpLink("https://countries.trevorblades.com/");
final ValueNotifier<GraphQLClient> client = ValueNotifier<GraphQLClient>(
GraphQLClient(
link: httpLink as Link,
cache: OptimisticCache(
dataIdFromObject: typenameDataIdFromObject,
),
),

In this code, as you can see, we create a final Httplink in which we pass the server link(API). And we create a client by using the ValueNotifier in which we pass GraphQLClient. ValueNotifier extends ChangeNotifier implements ValueListenable.

GraphQLClient({
required Link link,
required GraphQLCache cache,
DefaultPolicies? defaultPolicies,
bool alwaysRebroadcast = false,
})

In GraphQLClient we have two properties, link, and client. The Link over which GraphQL documents will be resolved into a Response. In our example, we use GitHub Public API. in which we pass the HTTP link. And we use Cache to store the initial data.


GraphQLProvider:

In GraphQLProvider we pass two parameters, child and client. We already created a client by which we can fetch the server’s data and also store the initial data in the cache. We pass the client as a client and also navigate the next page on which we want to show the data in the child parameter.

GraphQLProvider(
child: HomePage(),
client: client,
);

This is the Syntax of GraphQLProvider:

(new) GraphQLProvider GraphQLProvider({
Key? key,
ValueNotifier ? client,
Widget? child, })

Query:

To fetch the exact data we use query. creating a query is very simple and easy we use GitHub Public API.

In the above picture, we saw a query in which we get the data of all continents’ names and codes.

final String query = r"""
query GetContinent($code : String!){
continent(code:$code){
name
countries{
name
}
}
}
""";

In this, we create a string of queries and use r “”” “”” for writing any query and write a query by which we fetch the data.

After that, we pass the query in Scaffold’s body as a widget.

(new) Query Query({
Key? key,
required QueryOptions options,
required Widget Function(QueryResult ,
{
Future > Function(FetchMoreOptions)? fetchMore, Future ?> Function()? refetch
})
builder, })

In this, we use two parameters in the query, Options, and builder. In QueryOptions we use documents to pass the query which we already defined as a string and we also pass variables in which we pass the code of the country.

options: QueryOptions(
document: query,
variables: <String, dynamic>{"code": "AS"}),

we can also pass many things in options like duration, Context, Object, Operation-name, DocumentNode, FetchPolicy, ErrorPolicy, etc.

(new) QueryOptions QueryOptions
({
required DocumentNode document,
String? operationName,
Map variables = const {},
FetchPolicy? fetchPolicy,
ErrorPolicy? errorPolicy,
CacheRereadPolicy? cacheRereadPolicy,
Object? optimisticResult,
Duration? pollInterval,
Context? context,
Object? Function(Map )? parserFn,
})

we use FetchMoreOption inside Query Builder to perform pagination. Function permits you to run an entirely new GraphQL operation and amalgamate the new results with the original results. You can re-use features of the Original query i.e. the Query or some of the Variables.

builder: (
QueryResult result, {
VoidCallback refetch,
}) {
if (result.loading) {
return Center(child: CircularProgressIndicator());
}
if (result.data == null) {
return Text("No Data Found !");
}
return ListView.builder(
itemBuilder: (BuildContext context, int index) {
return ListTile(
title:
Text(result.data['continent']['countries'][index]['name']),
);
},
itemCount: result.data['continent']['countries'].length,
);
},
),

In the builder, we use QueryResult to fetch the final result and create a voidcallback by using fetch. And we add a condition when the result is loading so its shows a CircularProgressIndicator(), and if there is no data in the list so it shows NO DATA FOUND. And return ListView.Builder(), in item builder we pass context and index and return the ListTile for printing the country name as a list and in the itemCount, we pass the length of a list.


Mutation:

The Mutation is used to update and insert data like for post/delete/put requests. The syntax for mutations is fairly similar to that of a query. The only difference is that the first quarrel of the builder function is a mutation function. Just call it to activate the mutations.

Mutation(
options: MutationOptions(
document: gql(addStar),
update: (GraphQLDataProxy cache, QueryResult result) {
return cache;
},
onCompleted: (dynamic resultData) {
print(resultData);
},
),
builder: (
RunMutation runMutation,
QueryResult result,
) {
return FloatingActionButton(
onPressed: () => runMutation({
'starrableId': <A_STARTABLE_REPOSITORY_ID>,
}),
tooltip: 'Star',
child: Icon(Icons.star),
);
},
);

Conclusion:-

In this article, we almost covered the very topic of GraphQL. We started by introducing, what GraphQL is and how it works. Then, we introduced graphql_flutter with examples of how to make queries, and mutations, from a Flutter app.

❤ ❤ 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 Implementing GraphQL in Flutter

GitHub – flutter-devs/graphql_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


❤ ❤ 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! 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.

The Role of QA in Agile Using Flutter

0

What exactly is the role of QA in agile?:

What can a tester do to help initiate a cooperative working relationship with the development team? Here are 6 things software testers should do when working with an agile scrum team:

  • > Attend sprint planning sessions: A member of QA should always attend planning sessions. Attending ensures QA is synchronized with the development team from the start and allows QA to identify possible problem areas and risks early on. Just like developers estimate the effort it will take for them to write code, QA should estimate the effort required for testing the code during the planning session. Without QA present, testing efforts and a realistic time allocation can be overlooked and not included in the sprint’s overall estimates.
  • > Attend daily stand-ups: A member of the QA team should always attend the daily stand-ups. Doing so promotes a collaborative team environment, making QA feel involved and a part of the team. Additionally, by QA being present, they can stay up to date with how the sprint is going, which allows them to plan their workload. If a tester has a blocker, they can bring this up during the stand-up. QA’s presence in stand-ups also gives them a chance to update on known issues, allowing developers to keep up to speed on testing progress and better plan their workload.
  • > Don’t save all the testing for the end; test throughout the sprint: To deliver high-quality software in a short amount of time, you need to work efficiently. QA’s test workload takes place throughout the sprint, which allows for issues to be found earlier instead of only at the sprint’s conclusion. If you find all the bugs at the end of the sprint, it’s too late. Integrating testing and development allows the two teams to work together and resolve issues faster, leading to higher quality results.
  • > Meet with developers for short, hand-off demonstrations: It’s hard to argue against the value of in-person communication. Assuming QA and development work in the same location, schedule a quick face-to-face hand-off demonstration for each feature. Doing this allows QA to see precisely how the new feature works and is also a good time for them to ask the developer any questions. These hand-offs can also bring to light issues the developer may not have considered yet. These interactions also help shorten the feedback loop between development and QA
  • > Attend sprint retrospectives: Don’t miss out on the opportunity to discuss successes and failures that can improve future sprints by failing to attend the final team meeting. No matter how good a team is, there will always be room for improvement. Sprint retrospectives are the opportunity to define weaknesses and determine solutions for them. QA needs to be involved in these discussions to have any concerns addressed before the next sprint begins. For example, maybe a lot of the work was delivered to QA late in the sprint, leading to a rushed testing effort. QA might raise this concern to avoid it happening again the next time.
  • > Document test cases: Just because you’re an agile team doesn’t mean you should skip documentation. Documentation is essential, especially for QA. Keep your documentation lean because changes are bound to happen. Even minimal documentation can add a lot of value to you and your team. For example, if testers shift from project to project, having some test documentation will help get the new team member up to speed faster.

In summary, agile embraces lean, flexible processes, tools, and documentation. There QA can focus on tasks that result in one thing: quickly delivering a high-quality product.

Flutter allows you to build an app for iOS and Android on Agile Methodologies:

Flutter is an open-source, cross-platform SDK that allows developers to share code across platforms. It uses Dart as a programming language and compiles your code into native machine code. You can thus use the same code base and build an app for iOS and Android platforms. Therefore, it ensures speedy app development allowing you to make more profits.

  • > Increases team productivity: Flutter saves a lot of development time and effort for the teams. It allows them to share a single code base and launch applications on multiple platforms. This ensures the higher productivity of members involved in the project.
  • > Offers Great Performance: Flutter is flooded with widgets, widgets that serve various purposes. The Dart compiler comprises its widgets, and hence it doesn’t need a JavaScript bridge to address the gap. Hence, an app developed using Flutter shows better performance than any other.
  • > It is highly compatible: When you are building an app using Flutter, you can rest assured about its performance. The built-in widgets work in the same manner across all the platforms without disturbing the user experience. The uniformity in performance across various platforms is something that developers embrace about Flutter the most.

Agile Sprint Backlog and Planning:

The entire team working together Agile for Flutter app development checks the pending backlogs and plans out a sprint to cover them up.

Many entrepreneurs have this big misconception that Agile for Flutter mobile app development is only for big giants. However, in our opinion, small to medium-sized businesses can leverage the methodology and make a fortune out of it. Small and medium enterprises do not have clear roles and responsibilities defined. They always juggle the tasks, which may impact their productivity and efficiency.

Adopting Agile methodology in Flutter app development will simplify the entire process and make things clear for them. This will allow the small companies to accomplish a complex task that would have found difficult, with much ease & comfort.

Scenario:

A description of each specific scenario of the narrative with the following structure:

  • > Given: the initial context at the beginning of the scenario, in one or more clauses;
  • > when: the event that triggers the scenario;
  • > then: the expected outcome, in one or more clauses.

What I love here is the test verbosity. The text is clear and every situation can be documented and tested. That’s what I’m searching to expose to our non-tech. This would let them know what developers do each day and show non-tech the amount of work they have to do for “simple” things the same thing tested by the testers.


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! 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.

Form Validation with Stream BloC and RxDart

0

In this article, we will explore the Form Validation with Stream BloC and RxDart. We will also implement a demo program and learn how to implement it in your flutter applications.

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.


Introduction:

First of all, I would like to introduce you to Validation with Stream BloC and RxDart.

RxDart:

RxDart is an implementation of the popular reactive API for asynchronous programming, leveraging the native Dart Streams API. Changelog.

FlutterBloC:

Flutter Widgets that make it easy to implement the BLoC (Business Logic Component) design pattern. Built to be used with the bloc state management package. Widgets that make it easy to integrate blocs and cubits into Flutter. Built to work with package: bloc.

Implementation:

Let’s see how to Implement the form validation with stream bloc.

First Add these two dependencies in pubsec.yaml file

dependencies:
flutter_bloc: ^8.0.1
rxdart: ^0.27.3

Alright, now we will work on our stream part for this. First of all, we will create a new file and call it login_bloc_state.dart

part of 'login_bloc_cubit.dart';

abstract class LoginBloc {}

class LoginInitial extends LoginBloc {}

Secondly, we will create the login_bloc_cubit.dart file

Behavior Subject:
The BehaviorSubject is, by default, a broadcast (aka hot) controller, to fulfill the Rx Subject contract. This means the Subject’s stream can listen to multiple times.

Rx.combineLatest:
Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element. Observables need to be an array. If the result selector is omitted, a list with the elements will be yielded.

import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:rxdart/rxdart.dart';
part 'login_bloc_state.dart';
class LoginScreenCubit extends Cubit<LoginBloc> {
LoginScreenCubit() : super(LoginInitial());
final _userNameController = BehaviorSubject<String>();
final _passwordController = BehaviorSubject<String>();
Stream<String> get userNameStream => _userNameController.stream;
Stream<String> get passwordStream => _passwordController.stream;

void clearStreams() {
updateUserName('');
updatePassword('');
}

void updateUserName(String userName) {
if (userName.length < 4) {
_userNameController.sink.addError("Please enter at least 4 characters of your name here");
} else {
_userNameController.sink.add(userName);
}
}

void updatePassword(String password) {
if (password.length < 4) {
_passwordController.sink.addError("Please enter at least 4 character of the password here");
} else {
_passwordController.sink.add(password);
}
}

Stream<bool> get validateForm => Rx.combineLatest2(
userNameStream,
passwordStream,
(a, b,) => true,
);
}

Note: You can learn more about behavior subjects over here

Setup Bloc Providers file:-

import 'package:flutter_bloc/flutter_bloc.dart';

import 'bloc/login_bloc_cubit.dart';

List<BlocProvider> blocProviders = [
BlocProvider<LoginScreenCubit>(create: (context) => LoginScreenCubit()),
];

Setup main.dart file:-

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

import 'bloc_providers.dart';
import 'login_screen.dart';

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

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

@override
Widget build(BuildContext context) {
return MultiBlocProvider(
providers: blocProviders,
child: const MaterialApp(
debugShowCheckedModeBanner: false,
home: LoginScreen(),
),
);
}
}

Finally, we will design Login Screen UI:

Wrap TextFormField with StreamBuilder widget and provide stream to it.Invoke validator function from on Changed callback of TextFormField.

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

import 'bloc/login_bloc_cubit.dart';
import 'custom_widgets/custom_plain_button.dart';
import 'custom_widgets/custom_text_field.dart';

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

@override
State<LoginScreen> createState() => _LoginScreenState();
}

class _LoginScreenState extends State<LoginScreen> {
LoginScreenCubit? _loginScreenCubit;

@override
void initState() {
WidgetsBinding.instance?.addPostFrameCallback((_) {
_loginScreenCubit?.clearStreams();
});
super.initState();
}

@override
Widget build(BuildContext context) {
_loginScreenCubit = BlocProvider.of<LoginScreenCubit>(
context,
listen: false,
);
return Scaffold(
appBar: AppBar(
title: const Text('Validation with BloC'),
),
backgroundColor: Colors.white,
body: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 10,
),
child: Column(
children: [
Expanded(child: _buildMiddleView()),
_buildBottomButtonView()
],
),
),
),
);
}

_buildMiddleView() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
'Login In',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30),
),
const SizedBox(
height: 10,
),
StreamBuilder(
stream: _loginScreenCubit?.userNameStream,
builder: (context, snapshot) {
return CustomTextField(
onChange: (text) {
_loginScreenCubit?.updateUserName(text);
},
labelText: 'Username',
textInputType: TextInputType.emailAddress,
);
}),
const SizedBox(
height: 10,
),
StreamBuilder(
stream: _loginScreenCubit?.passwordStream,
builder: (context, snapshot) {
return CustomTextField(
onChange: (text) {
_loginScreenCubit?.updatePassword(text);
},
labelText: 'Password',
textInputType: TextInputType.text,
isObscureText: true,
);
}),
const SizedBox(
height: 10,
),
],
);
}

_buildBottomButtonView() {
return StreamBuilder(
stream: _loginScreenCubit?.validateForm,
builder: (context, snapshot) {
return CustomPlainButton(
isEnabled: snapshot.hasData,
btnColor: snapshot.hasData ? Colors.red : Colors.grey,
height: 67,
onTap: snapshot.hasData ? _loginBtnTap : null,
label: 'Log in',
lblColor: Colors.white,
);
},
);
}

_loginBtnTap() {
print('Login Button Pressed');
}
}

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

Output
  • > Wrap TextFormField with StreamBuilder widget and provide stream to it:
    StreamBuilder has 2 required parameters, stream and builder callback. StreamBuilder will listen to the provided stream and the builder function will facilitate us to build the UI accordingly.
StreamBuilder(
stream: _loginScreenCubit?.passwordStream,
builder: (context, snapshot) {
return CustomTextField(
onChange: (text) {
_loginScreenCubit?.updatePassword(text);
},
labelText: 'Password',
textInputType: TextInputType.text,
isObscureText: true,
);
}),
  • > Invoke validator function from on Changed callback of TextFormField:

We’ll utilize the on Changed callback of TextFormField and invoke the validator method.

onChange: (text) {
_loginScreenCubit?.updatePassword(text);
},

Then, we will Making button enabled or Disable

We will use RxDart’s combined latest function to check if both streams have data, as a boolean, and again send it as a stream, to be able to utilize it to make the button enabled.

The new stream will emit true when we have passed all the validations by checking if both the streams have data and none has an error with it.

Stream<bool> get validateForm => Rx.combineLatest2(
userNameStream,
passwordStream,
(a, b,) => true,
);

Connecting the resultant stream to the button

Wrap the button with stream builder and provide the combined stream in the stream property.

StreamBuilder(
stream: _loginScreenCubit?.validateForm,
builder: (context, snapshot) {
return CustomPlainButton(
isEnabled: snapshot.hasData,
btnColor: snapshot.hasData ? Colors.red : Colors.grey,
height: 67,
onTap: snapshot.hasData ? _loginBtnTap : null,
label: 'Log in',
lblColor: Colors.white,
);
},
);

For making the button be enabled according to the validations, we will use the stream snapshots has data property to check if it has data and connects it to the buttons onTap property so that if it doesn’t have data we will set it onTap property to null, making button disabled.

onTap: snapshot.hasData ? _loginBtnTap : null,

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

Output

❤ ❤ 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 validation_with_stream_bloc:

GitHub – flutter-devs/validation_with_stream_bloc
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! 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.

Exploration Of Unit Testing In Flutter

0

In this article, we will explore the Unit Testing in Flutter. How unit testing works, how we create the class and how the outcomes appear in your project.

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

Steps

Run tests using IntelliJ or VSCode

Run tests in a terminal

Why is unit testing important?

Unit test example

Conclusion


So let’s start with it.


An introduction to Unit Testing:

Unit testing is a software testing technique by which individual units of source code sets of at least one computer program module along with related control information, use procedures, and operating methodology — are tested to decide if they are fit for use. Unit tests are commonly automated tests composed and run by software developers to guarantee that an application meets its plan and acts as intended.

In software testing, unit testing is a strategy for testing more isolated portions (or units) of code. Unit tests are generally directed with test automation scripts on the smallest testable portion of the software.

The unit is usually a function of the code. It is also a part of “white box testing,” which is a type of testing that can be written by someone who knows the architecture of the program.

This methodology can test code functions, strategies, or methods whether using procedural programming or object-oriented programming. If it depends on or converses with some other frameworks, it can’t be qualified as unit testing. The object is to guarantee that every unit of code functions true to form. This takes into consideration quality confirmation to write test cases just for bits of the software that influence the way of behaving of the framework.

Unit tests are handy for verifying the behavior of a single function, method, or class. The test package provides the core framework for writing unit tests, and the flutter_test package provides additional utilities for testing widgets.

Steps:

This recipe demonstrates the core features provided by the test package using the following steps:

  • Add the test or flutter_test dependency.
  • Create a test file.
  • Create a class to test.
  • Write a test for our class.
  • Combine multiple tests in a group.
  • Run the tests.

> Add the test dependency:

The test package provides the core functionality for writing tests in Dart. This is the best approach when writing packages consumed by web, server, and Flutter apps.

dev_dependencies:
test: <latest_version>

> Create a test file:

In this example, create two files: counter.dart and counter_test.dart.

The counter.dart file contains a class that you want to test and resides in the lib folder. The counter_test.dart file contains the tests themselves and lives inside the test folder.

In general, test files should reside inside a test folder located at the root of your Flutter application or package. Test files should always end with _test.dart, this is the convention used by the test runner when searching for tests.

When you’re finished, the folder structure should look like this:

counter_app/
lib/
counter.dart
test/
counter_test.dart

> Create a class to test:

Next, you need a “unit” to test. Remember: “unit” is another name for a function, method, or class. For this example, create a Counter class inside the lib/counter.dart file. It is responsible for incrementing and decrementing a value starting at 0.class Counter {
int value = 0; void increment() => value++; void decrement() => value–;

> Write a test for our class:

Inside the counter_test.dart file, and write the first unit test. Tests are defined using the top-level test function and you can check if the results are correct by using the top-level expect function. Both of these functions come from the test package.

// Import the test package and Counter class
import 'package:test/test.dart';
import 'package:counter_app/counter.dart';void main() {
test('Counter value should be incremented', () {
final counter = Counter(); counter.increment(); expect(counter.value, 1);
});
}

> Combine multiple tests in a group:

If you have several tests that are related to one another, combine them using the group function provided by the test package.

import 'package:test/test.dart';
import 'package:counter_app/counter.dart';void main() {
group('Counter', () {
test('value should start at 0', () {
expect(Counter().value, 0);
}); test('value should be incremented', () {
final counter = Counter(); counter.increment(); expect(counter.value, 1);
}); test('value should be decremented', () {
final counter = Counter(); counter.decrement(); expect(counter.value, -1);
});
});
}

> Run the tests:

Now that you have a Counter class with tests in place, you can run the tests.

Run tests using IntelliJ or VSCode:

The Flutter plugins for IntelliJ and VSCode support running tests. This is often the best option while writing tests because it provides the fastest feedback loop as well as the ability to set breakpoints.

  • > IntelliJ:-
  • Open the counter_test.dart file
  • Select the Run menu
  • Click the Run 'tests in counter_test.dart' option
Alternatively, use the appropriate keyboard shortcut for your platform.
  • > VSCode:-
  • Open the counter_test.dart file
  • Select the Run menu
  • Click the Start Debugging option
  • Alternatively, use the appropriate keyboard shortcut for your platform.

Run tests in a terminal:

You can also use a terminal to run the tests by executing the following command from the root of the project:

flutter test test/counter_test.dart

For more options regarding unit tests, you can execute this command:

flutter test --help

Why is unit testing important?:

Unit testing is very important as it allows developers to detect bugs earlier in the lifecycle- thus improving the quality of delivered software. Here is a list of great benefits:

  • > This methodology can reduce the overall impact on testing costs as bugs are caught in the early phases of development.
  • > It allows better refactoring of code as it is more reliable code.
  • > This practice also conditions developers to rethink how they code. Meaning, coding modular components that can be mocked if they do have dependencies.
  • > Tests can be automated, which is extremely beneficial when maintaining code at scale.
  • > Overall, it improves the quality of the code.

In DevOps, the process of continuous integration automatically runs tests against the code every time someone commits new code to the repository. If one test fails, the entire team can receive an email (or alert on Slack) of the break. Then the responsible person can rectify the issue.

Unit test example:

Here is a simple example of how to write unit tests.

Let’s say we’re trying to implement the sum function. It takes two numbers a and b as its arguments and returns the number of the total amount.

def sum(a, b):
return a + b

The simplest way to write a unit test is by using the assert function. This function can be found in most programming languages.

# It should pass
assert sum(1, 2) == 3
# It also should pass
assert sum(1, 2) != 0

Conclusion:

If you are performing automated tests consistently, you can see how beneficial unit testing is for catching bugs early on. Without this technique, a defect could make its way farther into the pipeline. Even worse, into production.

This means time and resources are allocated to finding, analyzing, and fixing defects when a simple automated test could have caught them. If your firm seeks a test automation tool to automatically catch bugs and alert developers via Slack.


❤ ❤ 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! 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.

CupertinoPageTransition In Flutter

0

Whenever you will code for building anything in Flutter, it will be inside a widget. The central design is to build the application out of widgets. It portrays how your application view ought to look with its current design and state. Right when you made any adjustment in the code, the widget alters its depiction by working out the differentiation between the past and current widget to choose the immaterial changes for conveying in the UI of the application.

In Flutter, to build any application, we start with widgets. The construction block of flutter applications. Widgets portray what their view should look like given their current setup and state. It consolidates a text widget, line widget, segment widget, container widget, and some more.

Navigating between routes is very quite default. Flutter benevolently gives you the MaterialPageRoute and CupertinoPageRoute classes and, while their transition animations don’t look awful, there’s surely something more we can do.

In this article, we will explore the CupertinoPageTransition In Flutter. We will implement the Cupertino page transition demo program and learn how to use the same in your flutter applications.

CupertinoPageTransition class – cupertino library – Dart API
API docs for the CupertinoPageTransition class from the Cupertino Library, for the Dart programming language.api.flutter.dev

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::

Cupertino Page Transition

Constructor

Properties

Code Implement

Code File

Conclusion

GitHub Link



CupertinoPageTransition:

It is a widget that provides an iOS-style page transition animation. The page slides in from the right and exits backward. It likewise moves to one side in a parallax motion when another page enters to cover it.

Demo Module :

This demo shows how the transition works in an app. It shows how the page transitions from right to left just like your transition to another page on a device running on iOS/Android.

Constructor:

To utilize CupertinoPageTransition, you need to call the constructor underneath:

CupertinoPageTransition({
Key key,
@required Animation<double> primaryRouteAnimation,
@required Animation<double> secondaryRouteAnimation,
@required Widget child,
@required bool linearTransition,
});

In Above Constructor all fields marked with @required must not be empty.

Properties:

There are some properties of CupertinoPageTransition:

  • > Widget Child: The widget below this widget in the tree. Child Property will have only one child.
  • > Animation<double> primaryRouteAnimation: primaryRouteAnimation is a linear route animation from 0.0 to 1.0 when this screen is being pushed.
  • > Animation<double> secondaryRouteAnimation: secondaryRouteAnimation is a linear route animation from 0.0 to 1.0 when another screen is being pushed on top of this one.
  • > bool linearTransition: linear transition is whether to perform the transitions linearly. Used to precisely trackback gesture drags.

How to implement code in dart file:

You need to implement it in your code respectively:

Create a new dart file called main.dart inside the lib folder.

First, we will make a screen that will show the underlying page and a picture in the center that has an on-tap function which will set off the transition. Then we will make a subsequent page and set it up with another picture, then we want to set up a route style which will be the Cupertino page transition widget.

Center(
child: InkWell(
onTap: () => Navigator.of(context).push(PageTwo.route()),
child: Image.asset('assets/pencil.png'),
),
),

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

Initial Screen

With the help of this route property, we will transact from the initial page to the final page with a transition style straight from iOS.

static Route<dynamic> route() {
return CupertinoPageRoute(
builder: (BuildContext context) {
return const PageTwo();
},
);
}

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

Final Output

Code File:

import 'package:flutter/cupertino.dart' show CupertinoPageRoute;
import 'package:flutter/material.dart';

void main() {
runApp(
const MaterialApp(
debugShowCheckedModeBanner: false,
home: Splash(),
),
);
}

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

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
automaticallyImplyLeading: false,
title: const Text('Flutter CupertinoPageTransition Demo'),
backgroundColor: Colors.teal,
),
body: Center(
child: InkWell(
onTap: () => Navigator.of(context).push(PageTwo.route()),
child: Image.asset('assets/pencil.png'),
),
),
);
}
}

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

static Route<dynamic> route() {
return CupertinoPageRoute(
builder: (BuildContext context) {
return const PageTwo();
},
);
}

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: Image.asset('assets/logo.png'),
),
);
}
}

Conclusion:

In the article, I have explained the essential construction of the CupertinoPageTransition widget in a flutter; you can alter this code as indicated according to your choice. This was a little prologue to the CupertinoPageTransition widget on User Interaction from my side, and its functioning utilizing Flutter.

I hope this blog will provide you with sufficient information on Trying up the CupertinoPageTransition widget in your flutter projects. We showed you what the CupertinoPageTransition widget is?, its constructor, and the properties of the CupertinoPageTransition widget. We made a demo program for working CupertinoPageTransition widget, and it shows transitions directly from the iOS/Android in your flutter application. So please try it.

❤ ❤ 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 thecupertino_page_transition:

GitHub – flutter-devs/cupertino_page_transition
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! 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.


Flutter App for Web

0

Hello everyone! This is my first project on Flutter Web. Today we learn about how to create web applications using Flutter. For more understanding, we create a demo on Flutter Web.

Flutter’s web help develops applications that are wealthy in intuitive content. Web helps for Flutter gives a browser-based conveyance model for Flutter mobile applications. Flutter renders web applications similarly as it will deliver your android/iOS applications. It likewise converts your project over completely to native code (HTML, CSS, JS) when you wish to deploy.

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:

Requirements For Flutter Web App

Important’s of Flutter Web

How is the performance for Flutter Web and how it is different

Set Up For Flutter Web App

Implementation

Conclusion

GitHub Link


Requirements For Flutter Web App:

We have some important requirements for creating any Flutter Web App.

  • > Flutter SDK. See the Flutter SDK installation instructions.
  • > Chrome; debugging a web app requires the Chrome browser.
  • > Optional: An IDE that supports Flutter. You can install Android Studio, IntelliJ IDEA, or Visual Studio Code and install the Flutter and Dart plugins to enable language support and tools for refactoring, running, debugging, and reloading your web app within an editor. See setting up an editor for more details.

Important’s of Flutter Web:

Some important points of flutter web:

  • > Users can open your website in any screen size, you need to make it responsive.
  • > Many packages that bear the web, but always examine the supported platforms before coding.
  • > If you are from a web development background and if you perceive to make any changes in native code, you are highly welcome to do so. You can replace the native code the same way we can change it for Android and iOS.
  • When you want to deploy your web app, you can simply run:
flutter build web

How is the performance for Flutter Web and how it is different:

  • > FlutterWeb works in appealing smooth contrast to native as it creates only a single page and hence generates less cargo on the browser.
  • > With the help of Flutter, you can create some great animations very easily compared to native, hence making your web app more beautiful, and it is very useful for complex web applications.
  • > Flutter Web directly bear installing your website as a unfasten application (Web-App) for which you require to individually code if in native.
  • > Flutter, as it is a cross-platform framework, you can add some platform-specific code without any configuration changes by which we can apply many new things to our web application.

Set Up For Flutter Web App:

  • > First, we have to create a flutter project and choose the web platforms in android studio. We choose android, Ios, and Web. if we want to create an app for Linux, Windows, or Mac OS so we have to select these options
  • > Then, we have to check the flutter channel, for Flutter Channel we use channel beta if your flutter channel is different then you have to change the channel to beta by using this command.
$ flutter channel beta
  • > After changing the channel we have to upgrade the version of flutter by using this command.
$ flutter upgrade
  • > When we change the channel and also upgrade the flutter we have to config or enable the web to run the flutter web app. After running this command we have to restart the Android Studio and run the project on chrome or any other browser.
$ flutter config --enable-web
  • > After running this command we have to restart the android studio. when its opens we find a new folder whose name is the web. In the web folder we find many files like index.html, manifest.json, and also find a folder with the name of icons.

We can start our coding part to create a better Flutter Web Application.


Implementation:

Now we create a Flutter Web Application. Give the name of the application is flutter_web_demo. In main. dart we pass the MyApp() class in the runApp() and create a stateless class with the name of MyApp() and return MaterialApp in the context and pass the new class whose name is HomePage.

return const MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
home: HomePage(),
);

In the HomePage class we return the Scaffold and use the properties of the scaffold, in the app-bar we pass the title of the page.

appBar: AppBar(
backgroundColor: Colors.black,
centerTitle: true,
title: const Text('Flutter Web App',
style: TextStyle(
color: Colors.white
),),
),

And create a button in the center of the page. Add a text at the button which is “click me” and by using the GestureDetector() we can tap on the button and go to the new page, which is the second page of the application. On tap, we navigate the screen to a new page by using Navigator. push().

GestureDetector(
onTap: (){
Navigator.push(context,
MaterialPageRoute(builder: (context)=> const NewScreen()));
},
child: Container(
height: 50,
width: 150,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Colors.black,
),
child: const Center(child: Text('CLICK ME!!!',
style: TextStyle(
color: Colors.white
),)),
),
),

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

Output

In the new screen whose class name is NewScreen(), we return Scaffold and pass text in the body of it.

return const Scaffold(
body: Center(child: Text('Welcome to Flutter Web App...',
style: TextStyle(
fontStyle: FontStyle.italic,
fontSize: 30,
fontWeight: FontWeight.w500,
color: Colors.teal
),)),
);

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

Output

Conclusion:

I hope you like my article. Flutter web is extremely useful for web developers and also for app developers. Because of this, we don’t need to learn HTML, CSS, or JS. There are many browsers like Chrome, Safari, Edge and Firefox, Chrome (on Windows, macOS, and Linux), and Edge (on Windows).


❤ ❤ 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 Implementing Flutter App for Web

GitHub – flutter-devs/flutter_web_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! 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.


Validation Using Bloc In Flutter

0

Hello Everyone! In this article, we learn about Bloc in Flutter. we cover many topics of the bloc like Bloc Widgets, Bloc Builder, Bloc Selector, Bloc Provider, Multi Bloc Provider, Bloc Listener, Multi Bloc Listener, etc…

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 Bloc?

Bloc Widgets

Implementation

Conclusion

GitHub Link


What Is Bloc?

Flutter Bloc is one of the state management in a flutter. We can use it to handle all the states which we want to perform in our flutter applications.

Bloc is the best and simple way to do state management. We can easily add any type of change to the Flutter application. You can easily learn the concept, no matter what’s your level. You can add this dependency to your project and use it.

Bloc is a design pattern created by Google to help separate business logic from the award layer and authorize a developer to exploit code more efficiently.

A state management library called Bloc was created and maintained by Felix Angelo. It assists developers utensil the Bloc design pattern in their Flutter application. It means that a developer must recognize the state of an app at some time. There should be something exhibited on the screen for every interplay with the app to let users know what is incident.


Bloc Widgets

There are many Wiglets in Flutter Bloc:

> Bloc Builder:

Bloc-builder is a Flutter widget that needs a bloc and a builder function. Bloc-builder holds building the widget in response to new states. Bloc-builder is very alike to Stream-builder but has a more simple API to decrease the quantity of boilerplate code needed. The builder function will potentially be called many times and should be an unalloyed function that returns a widget in reaction to the state.

BlocBuilder<BlocA, BlocAState>(
builder: (context, state) {
// return widget here based on BlocA's state
}
)

> Bloc Selector:

Bloc-selector is a Flutter widget that is comparable to BlocBuilder but permits developers to filter modernize by selecting a new worth based on the contemporary bloc state. dispensable builds are averted if the selected value does not switch. The pick value must be fixed for Bloc Selector to correctly control whether the builder should be called again.

BlocSelector<BlocA, BlocAState, SelectedState>(
selector: (state) {
// return selected state based on the provided state.
},
builder: (context, state) {
// return widget here based on the selected state.
},
)

> Bloc Provider:

Bloc Provider is a Flutter widget that provides a bloc to its children via BlocProvider.of<T>(context). It is worn as a dependency injection (DI) widget to bestow a lone instance of a bloc to beau-coup widgets within a sub-tree.

BlocProvider(
create: (BuildContext context) => BlocA(),
child: ChildA(),
);

> MultiBlocProvider:

Multi Bloc Provider is a Flutter widget that amalgamates multiple Bloc Provider widgets into one. MultiBlocProvider better the readability and removes the need to nest multipleBlocProviders.

BlocProvider<BlocA>(
create: (BuildContext context) => BlocA(),
child: BlocProvider<BlocB>(
create: (BuildContext context) => BlocB(),
child: BlocProvider<BlocC>(
create: (BuildContext context) => BlocC(),
child: ChildA(),
)
)
)

> Bloc Listener:

Bloc Listener is a Flutter widget that clasps a BlocWidgetListener and a voluntary bloc and invokes the listeners in response to state swap in the bloc. It should be worn for functionality that needs to happen once per state change such as navigation, showing a Snack-bar, showing a Dialog, etc…

BlocListener<BlocA, BlocAState>(
listener: (context, state) {
// do stuff here based on BlocA's state
},
child: Container(),
)

> Multi Bloc Listener:

Multi Bloc Listener is a Flutter widget that amalgamates multiple BlocListener widgets into one. MultiBlocListener better the readability and eliminates the requirement to nest multipleBlocListeners. By utilizing multipleBlocListener we can go from:

BlocListener<BlocA, BlocAState>(
listener: (context, state) {},
child: BlocListener<BlocB, BlocBState>(
listener: (context, state) {},
child: BlocListener<BlocC, BlocCState>(
listener: (context, state) {},
child: ChildA(),
),
),
)

Implementation:

First, we have to add dependency in pubspec.ymal file for getting all the properties of the bloc by which we can easily use it for state management.

dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
rxdart: ^0.27.3
flutter_bloc: ^8.0.1

We use two dependencies flutter_bloc and rxdart. RxDart extends the capabilities of Dart Streams and Stream-controllers. Flutter_bloc uses Bloc Provider to provide a Counter-cubit to a Counter-Page and react to state changes with BlocBuilder.

First, we have to create a cubit class(login_bloc_cubit.dart) for the app which is an abstract class Cubit extends Bloc-base. We create the class by the name LoginScreenCubit(). In this class first, we have to define the argument constructor. After that, we define all the controllers which we used.

LoginScreenCubit() : super(LoginInitial());

//define controllers
final _userNameController = BehaviorSubject<String>();
final _passwordController = BehaviorSubject<String>();
final _phonenoController = BehaviorSubject<String>();

and we get the data with the help of Stream and defined controllers.

Stream<String> get userNameStream => _userNameController.stream;
Stream<String> get passwordStream => _passwordController.stream;
Stream<String> get phonenoStream => _phonenoController.stream;

we also create a method for clearing the data

void dispose() {
updateUserName('');
updatePassword('');
updatePhoneNumber('');
}

and add the methods for validation which is very important and in which we check the value of the user.

//validation of UserName
void updateUserName(String userName) {
if (userName.length < 3) {
_userNameController.sink.addError("Please enter at least 3 words");
} else {
_userNameController.sink.add(userName);
}
}

//validation of Password
void updatePassword(String password) {
if (password.length < 4) {
_passwordController.sink.addError("Please enter more then 4 words");
} else {
_passwordController.sink.add(password);
}
}

//validation of Phone Number
void updatePhoneNumber(String phoneNo) {
if (phoneNo.length == 10) {
_phonenoController.sink.add(phoneNo);
} else {
_phonenoController.sink.addError("Please enter valid Phone Number");

}
}

After that, we create a provider class(bloc_provider.dart) in which we pass all the providers which are used in the Flutter application.

List<BlocProvider> blocProviders = [
BlocProvider<LoginPageCubit>(create: (context) => LoginPageCubit()),
];

And wrap MaterialApp() with MultiBlocProvider(), which we already define in the bloc_provider.dart in main. dart class. And pass the bloc Provider in providers.

MultiBlocProvider(
providers: blocProviders,
child: const MaterialApp(
debugShowCheckedModeBanner: false,
home: LoginScreen(),
),
);

And create a class with the name of login_bloc_state.dart. In which we define the LoginBloc{} class and LoginInitial which extends to LoginBloc{}.

abstract class LoginBloc {}
class LoginInitial extends LoginBloc {}

In the LoginScreen(login_screen.dart) First we define the LoginScreenCubit. And then add initState(){} in which we add WidgetsBinding.instance and the use dispose method.

LoginScreenCubit? _loginScreenCubit;
@override
void initState() {
WidgetsBinding.instance?.addPostFrameCallback((_) {
_loginScreenCubit?.dispose();
});
super.initState();
}

In _loginScreenCubit, we add BlocProvider.

_loginScreenCubit = BlocProvider.of<LoginScreenCubit>(
context,
listen: false,
);

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

In the UI part, we create UI and use StreamBuilder for the text Field to update the data.

StreamBuilder(
stream: _loginScreenCubit?.passwordStream,
builder: (context, snapshot) {
return TextField(
onChanged: (text) {
_loginScreenCubit?.updatePassword(text);
},
decoration: const InputDecoration(
labelText: 'Password',
),
keyboardType: TextInputType.text);
}),

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

For Bottombutton we also use StreamBuilder. In this we pass _loginScreenCubit in the stream and cheBloc Widgetsck, whether the data is validated or not? after this we return GestureDetector() and apply a condition that if the data is updated then this screen goes to the next screen otherwise it’s showing an error. When the snapshot. data is true then the color of the button will be teal otherwise it’s grey.

_bottomButton() {
return StreamBuilder(
stream: _loginScreenCubit?.validateForm,
builder: (context, snapshot) {
return GestureDetector(
onTap: () {
if (snapshot.hasData) {
Navigator.push(
context, MaterialPageRoute(builder: (context) => Home1()));
}
},
child: Container(
decoration: BoxDecoration(
color: snapshot.hasData ? Colors.teal : Colors.grey,
borderRadius: BorderRadius.circular(30)),
height: 70,
width: MediaQuery.of(context).size.width,
child: const Center(
child: Text(
'Login',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 27),
),
),
),
);
},
);
}

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


Conclusion:

In this article, we have been through What is Bloc in Flutter along with how to implement it in a Flutter. By using we can perform many state management orations.


❤ ❤ 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 Validation Using Bloc In Flutter:

GitHub – flutter-devs/validation_using_bloc
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! 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.