During development, use an assert statement— assert(<condition>, <optionalMessage>); —to disrupt normal execution if a boolean condition is false. // Make sure the variable has a non-null value. assert(text != null); // Make sure the value is less than 100. assert(number < 100); // Make sure this is an https URL. assert(urlString.startsWith(‘https’)); content_copy To attach a… Continue reading Assert -Dart
Tag: dart
Flutter Container
The container in Flutter is a parent widget that can contain multiple child widgets and manage them efficiently through width, height, padding, background color, etc. It is a widget that combines common painting, positioning, and sizing of the child widgets. It is also a class to store one or more widgets and position them on… Continue reading Flutter Container
Flutter Scaffold
The Scaffold is a widget in Flutter used to implements the basic material design visual layout structure. It is quick enough to create a general-purpose mobile application and contains almost everything we need to create a functional and responsive Flutter apps. This widget is able to occupy the whole device screen. In other words, we… Continue reading Flutter Scaffold
Flutter Gestures
Gestures are an interesting feature in Flutter that allows us to interact with the mobile app (or any touch-based device). Generally, gestures define any physical action or movement of a user in the intention of specific control of the mobile device. Some of the examples of gestures are: When the mobile screen is locked, you… Continue reading Flutter Gestures
Flutter State Management
The widget can be classified into two categories, one is a Stateless widget, and another is a Stateful widget. The Stateless widget does not have any internal state. It means once it is built, we cannot change or modify it until they are initialized again. On the other hand, a Stateful widget is dynamic and… Continue reading Flutter State Management
Dart – String codeUnits Property
The string property codeunits in Dart programming language returned the list of UTF-16 code of the characters of a string. It is very useful string properties to directly find UTF-16 code units. Syntax: String.codeUnits Returns: a list of UTF-16 code units // main function start void main() { // initialize string st String st… Continue reading Dart – String codeUnits Property
HTML Document Object Model
We all know that dart is a type of javascript. So we can manipulate data inside HTML pages with the help of dart in a similar fashion as we can do with javascript. In HTML DOM (Document Object Model) every webpage is on a window, so it is considered as an object. The hierarchical model… Continue reading HTML Document Object Model
Dart – Unit Testing
Unit Testing is a process of testing individual components of a software/application separately, to ensure that each component is functioning as intended. It provides multiple advantages such as – Ability to test out individual components without running the whole software/application. Pinpoint errors easily inside a specific component. Dart provides a package called test which lets… Continue reading Dart – Unit Testing
Dart – Symbols
In Dart, Symbols are basically an object representation of either an identifier or operator. The symbols in dart are opaque and dynamic string names that cannot be changed and remains constant throughout the compile time. It can be used for reflecting the metadata on a type, such as a library or class. They are generally used… Continue reading Dart – Symbols
What is a future?
A future (lower case “f”) is an instance of the Future (capitalized “F”) class. A future represents the result of an asynchronous operation, and can have two states: uncompleted or completed. Uncompleted When you call an asynchronous function, it returns an uncompleted future. That future is waiting for the function’s asynchronous operation to finish or… Continue reading What is a future?