<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Amr Azzam</title>
    <description>The latest articles on DEV Community by Amr Azzam (@amrazzam31).</description>
    <link>https://dev.to/amrazzam31</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1258749%2F1d58ed0e-2e3f-4d91-b069-193567d293e8.jpeg</url>
      <title>DEV Community: Amr Azzam</title>
      <link>https://dev.to/amrazzam31</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/amrazzam31"/>
    <language>en</language>
    <item>
      <title>Mastering Dart Operators!</title>
      <dc:creator>Amr Azzam</dc:creator>
      <pubDate>Tue, 25 Feb 2025 09:17:00 +0000</pubDate>
      <link>https://dev.to/amrazzam31/mastering-dart-flutter-operators-5dh8</link>
      <guid>https://dev.to/amrazzam31/mastering-dart-flutter-operators-5dh8</guid>
      <description>&lt;p&gt;When working with Dart in Flutter, operators make our code cleaner, more efficient, and expressive! &lt;br&gt;
Let's explore some of the most useful ones with examples.&lt;/p&gt;

&lt;p&gt;1️⃣ &lt;strong&gt;Null-aware operators (??, ??=, ?.)&lt;/strong&gt;&lt;br&gt;
Dart makes handling null values easy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;String? name;
print(name ?? 'Guest'); // ➡️ 'Guest' (uses default if null)

name ??= 'John'; // Assigns 'John' only if name is null
print(name); // ➡️ 'John'

int? length = name?.length; // Safe null access
print(length); // ➡️ 4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2️⃣ &lt;strong&gt;Spread (...) and Null-aware Spread (...?)&lt;/strong&gt;&lt;br&gt;
Great for working with collections:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;List&amp;lt;int&amp;gt; numbers = [1, 2, 3];
List&amp;lt;int&amp;gt;? nullableList;

List&amp;lt;int&amp;gt; allNumbers = [0, ...numbers, 4, ...?nullableList];
print(allNumbers); // ➡️ [0, 1, 2, 3, 4]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3️⃣ &lt;strong&gt;Cascade (..) Operator&lt;/strong&gt;&lt;br&gt;
Used for chaining method calls:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;final controller = TextEditingController()
  ..text = "Hello, Flutter!"
  ..selection = TextSelection.collapsed(offset: 5);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4️⃣ &lt;strong&gt;Ternary (? :) &amp;amp; Null-aware Conditional (??)&lt;/strong&gt;&lt;br&gt;
Simplifies conditional expressions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int age = 18;
String status = age &amp;gt;= 18 ? 'Adult' : 'Minor';
print(status); // ➡️ 'Adult'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5️⃣ &lt;strong&gt;Null Check (!) Operator&lt;/strong&gt;&lt;br&gt;
Used when you're sure a value isn’t null:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;String? nullableString = "Dart";
String nonNullable = nullableString!;
print(nonNullable.length); // ➡️ 4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Operators make Dart code cleaner, safer, and more readable—a must for any Flutter Developer! 🚀&lt;/p&gt;

&lt;p&gt;Which operator is your favorite? Drop your thoughts in the comments! 💬👇&lt;/p&gt;

</description>
      <category>dart</category>
      <category>flutter</category>
      <category>cleancode</category>
      <category>programming</category>
    </item>
    <item>
      <title>MediaQuery vs LayoutBuilder in Flutter</title>
      <dc:creator>Amr Azzam</dc:creator>
      <pubDate>Thu, 18 Jul 2024 11:05:42 +0000</pubDate>
      <link>https://dev.to/amrazzam31/mediaquery-vs-layoutbuilder-in-flutter-3ni3</link>
      <guid>https://dev.to/amrazzam31/mediaquery-vs-layoutbuilder-in-flutter-3ni3</guid>
      <description>&lt;p&gt;In Flutter, both MediaQuery and LayoutBuilder are used to build responsive UIs, but they serve different purposes and have different use cases. Here's a detailed comparison to help you understand when and why you might use each of these widgets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MediaQuery&lt;/strong&gt;&lt;br&gt;
What is MediaQuery?&lt;br&gt;
MediaQuery is a widget that provides information about the size, orientation, and other properties of the device's screen and the current app's environment. It is used for querying the current media properties such as screen dimensions, text scale factor, and device pixel ratio.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Global Context: MediaQuery provides information based on the BuildContext in which it is called.&lt;/li&gt;
&lt;li&gt;Access to Screen Size: You can use MediaQuery to get screen width, height, and other dimensions.&lt;/li&gt;
&lt;li&gt;Performance: Accessing MediaQuery data is relatively cheap and doesn't rebuild widgets unnecessarily.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Typical Use Cases:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Adjusting layout based on screen size.&lt;/li&gt;
&lt;li&gt;Creating responsive designs where you need to access screen dimensions or orientation.&lt;/li&gt;
&lt;li&gt;Implementing logic that depends on the device’s properties, such as adjusting font sizes based on screen size or text scale factor.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example Usage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Widget build(BuildContext context) {
  final screenWidth = MediaQuery.of(context).size.width;
  return Container(
    width: screenWidth * 0.5,
    child: Text('Hello World'),
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pros:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simple and direct way to access screen size and other media properties.&lt;/li&gt;
&lt;li&gt;Best for global or static queries about the environment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Accessing MediaQuery in build method can cause inefficiencies if overused, as it does not listen to changes in layout.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;LayoutBuilder&lt;/strong&gt;&lt;br&gt;
What is LayoutBuilder?&lt;br&gt;
LayoutBuilder is a widget that allows you to build a widget tree based on the parent’s constraints. It gives you the ability to adapt your widget’s layout according to the constraints passed by its parent.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Constraint-Based: LayoutBuilder provides constraints from the parent widget, allowing you to build widgets based on the available space.&lt;/li&gt;
&lt;li&gt;Dynamic Layouts: It rebuilds whenever the parent’s constraints change, allowing for more flexible and adaptive layouts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Typical Use Cases:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creating layouts that need to adapt to the parent’s constraints.&lt;/li&gt;
&lt;li&gt;Building complex, responsive UI elements that need to change when the available space changes.&lt;/li&gt;
&lt;li&gt;When you need to build widgets based on the parent widget’s size and constraints.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example Usage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Widget build(BuildContext context) {
  return LayoutBuilder(
    builder: (context, constraints) {
      final maxWidth = constraints.maxWidth;
      return Container(
        width: maxWidth * 0.5,
        child: Text('Hello World'),
      );
    },
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pros:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;More flexible for dynamic layouts that need to adjust to changing constraints.&lt;/li&gt;
&lt;li&gt;Provides a mechanism to react to changes in the parent widget’s constraints.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Slightly more complex to use than MediaQuery.&lt;/li&gt;
&lt;li&gt;Can lead to excessive rebuilds if not used carefully.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;When to Use Each&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use MediaQuery when you need to query the device’s properties or global environment settings. It’s ideal for static information that doesn’t depend on the parent’s size or constraints.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use LayoutBuilder when you need to build a widget based on the constraints provided by the parent widget. It’s perfect for creating adaptive and responsive layouts that change according to available space.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>mediaquery</category>
      <category>layoutbuilder</category>
      <category>dimensions</category>
    </item>
    <item>
      <title>𝗗𝗶𝗳𝗳𝗲𝗿𝗲𝗻𝗰𝗲 𝗯𝗲𝘁𝘄𝗲𝗲𝗻 * 𝗮𝗻𝗱 ** 𝗶𝗻 𝗳𝗶𝗹𝗲 𝗽𝗮𝘁𝗵𝘀?</title>
      <dc:creator>Amr Azzam</dc:creator>
      <pubDate>Wed, 21 Feb 2024 11:27:17 +0000</pubDate>
      <link>https://dev.to/amrazzam31/--11ii</link>
      <guid>https://dev.to/amrazzam31/--11ii</guid>
      <description>&lt;p&gt;Single and Double Asterisks are both wildcard characters, but they have different meanings:&lt;br&gt;
(Single Asterisk):&lt;br&gt;
The * character matches zero or more characters within a single directory name or filename.&lt;br&gt;
It's typically used to match multiple files or directories based on a specific pattern within a single directory level.&lt;br&gt;
For example, file*.txt would match file1.txt, file2.txt, etc., within the same directory.&lt;/p&gt;

&lt;p&gt;** (Double Asterisks):&lt;br&gt;
The ** character, often used in glob patterns, matches zero or more directories and files, recursively.&lt;br&gt;
It's typically used to match files or directories across multiple directory levels.&lt;br&gt;
For example, root/*&lt;em&gt;/&lt;/em&gt;.txt would match all text files in any subdirectory of root, regardless of how deep they are nested.&lt;/p&gt;

&lt;p&gt;In summary, * matches within a single directory level, while ** matches recursively across multiple directory levels.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>In Dart: extends vs. with vs. implements</title>
      <dc:creator>Amr Azzam</dc:creator>
      <pubDate>Tue, 30 Jan 2024 06:15:49 +0000</pubDate>
      <link>https://dev.to/amrazzam31/in-dart-extends-vs-with-vs-implements-17gp</link>
      <guid>https://dev.to/amrazzam31/in-dart-extends-vs-with-vs-implements-17gp</guid>
      <description>&lt;p&gt;𝐞𝐱𝐭𝐞𝐧𝐝𝐬: Use extends to create a subclass that inherits the properties and methods of a superclass. The new class will inherit all the properties and methods of the superclass and can add additional properties and methods of its own. For example, if you have a superclass called Animal, you might create a subclass called Dog that extends Animal.&lt;/p&gt;

&lt;p&gt;𝐰𝐢𝐭𝐡: Use with to mix in the behavior of a mixin into a class. A mixin is a class that provides a set of methods and properties that can be added to another class without creating a new subclass. This allows you to reuse code across multiple classes in a flexible way. For example, you might define a mixin called Logger that provides a log method, and then mix it into several classes that need logging behavior.&lt;/p&gt;

&lt;p&gt;𝐢𝐦𝐩𝐥𝐞𝐦𝐞𝐧𝐭𝐬: Use implements to declare that a class conforms to a certain interface. An interface is a set of methods and properties that a class must implement in order to satisfy the interface. This allows you to write code that works with any class that implements the interface, without needing to know the specifics of each class. For example, if you have an interface called Drawable that specifies a draw method, you might declare that a class called Rectangle implements Drawable.&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>oop</category>
      <category>programming</category>
    </item>
    <item>
      <title>Why Flutter BLoC is Loved and Popular by the Developers?</title>
      <dc:creator>Amr Azzam</dc:creator>
      <pubDate>Wed, 24 Jan 2024 12:09:27 +0000</pubDate>
      <link>https://dev.to/amrazzam31/why-flutter-bloc-is-loved-and-popular-by-the-developers-1632</link>
      <guid>https://dev.to/amrazzam31/why-flutter-bloc-is-loved-and-popular-by-the-developers-1632</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;p&gt;𝗦𝗲𝗽𝗮𝗿𝗮𝘁𝗶𝗼𝗻 𝗼𝗳 𝗖𝗼𝗻𝗰𝗲𝗿𝗻𝘀: Flutter BLoC allows for the separation of business logic and UI. This means that developers can focus on implementing the business logic in the BLoC without worrying about the UI, and vice versa.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;𝗖𝗼𝗱𝗲 𝗥𝗲𝘂𝘀𝗮𝗯𝗶𝗹𝗶𝘁𝘆: With Flutter BLoC, developers can create reusable business logic components that can be used across different parts of the application. This reduces code duplication and makes it easier to maintain the application’s codebase.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;𝗣𝗿𝗲𝗱𝗶𝗰𝘁𝗮𝗯𝗹𝗲 𝗦𝘁𝗮𝘁𝗲 𝗠𝗮𝗻𝗮𝗴𝗲𝗺𝗲𝗻𝘁: Flutter BLoC provides a predictable way of managing the state of the application. The BLoC emits new states in response to events from the UI, making it easier to reason about the application’s behavior.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;𝗧𝗲𝘀𝘁𝗮𝗯𝗶𝗹𝗶𝘁𝘆: Flutter BLoC makes it easier to write unit tests for the business logic of the application. Since the BLoC is separate from the UI, it can be tested independently of the UI.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;𝗟𝗮𝗿𝗴𝗲 𝗮𝗻𝗱 𝗖𝗼𝗺𝗽𝗹𝗲𝘅 𝗔𝗽𝗽𝗹𝗶𝗰𝗮𝘁𝗶𝗼𝗻𝘀: Flutter BLoC is particularly well-suited for large and complex applications, as it provides a scalable architecture that can be extended as the application grows.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>bloc</category>
      <category>statemanagement</category>
    </item>
    <item>
      <title>Difference between APK and AAB Android files?</title>
      <dc:creator>Amr Azzam</dc:creator>
      <pubDate>Tue, 23 Jan 2024 08:44:08 +0000</pubDate>
      <link>https://dev.to/amrazzam31/difference-between-apk-and-aab-android-files-53j8</link>
      <guid>https://dev.to/amrazzam31/difference-between-apk-and-aab-android-files-53j8</guid>
      <description>&lt;p&gt;&lt;strong&gt;- Full form&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;APK:&lt;/em&gt; Android application package or Android package kit.&lt;br&gt;
&lt;em&gt;AAB:&lt;/em&gt; Android application bundle.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Submission&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;APK:&lt;/em&gt; is submitted and later downloaded in the same form as it is created.&lt;br&gt;
&lt;em&gt;AAB:&lt;/em&gt; is split into smaller APK files. Each split APK corresponds to a specific device configuration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Installation&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;APK:&lt;/em&gt; can be used to directly install an app on an Android device.&lt;br&gt;
&lt;em&gt;AAB:&lt;/em&gt; cannot themselves trigger installation. They defer APK generation to Google Play.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Size&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;APK:&lt;/em&gt; ensure larger app size because all resources are downloaded to the device irrespective of their need.&lt;br&gt;
&lt;em&gt;AAB:&lt;/em&gt; ensure smaller app size because each split APK contains device-specific resources.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Dynamic features&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;APK:&lt;/em&gt; all feature-based resources are stored within the APK file.&lt;br&gt;
&lt;em&gt;AAB:&lt;/em&gt; dynamic feature resources are stored on Google Play and called upon when needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Asset packs&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;APK:&lt;/em&gt; all assets are stored in the main APK file.&lt;br&gt;
&lt;em&gt;AAB:&lt;/em&gt; all assets not needed to install the app are stored on Google Play.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- App churn&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;APK:&lt;/em&gt; larger app size causes greater app churn.&lt;br&gt;
&lt;em&gt;AAB:&lt;/em&gt; smaller app size causes lower app churn.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Storage efficiency&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;APK:&lt;/em&gt; unnecessary resources take up a lot of device storage and reduce efficiency.&lt;br&gt;
&lt;em&gt;AAB:&lt;/em&gt; is more efficient in terms of space.&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>aab</category>
      <category>apk</category>
    </item>
    <item>
      <title>'𝗮𝗱𝗱𝗔𝗹𝗹' 𝘃𝘀 '𝗮𝗱𝗱𝗘𝗻𝘁𝗿𝗶𝗲𝘀' 𝗶𝗻 𝗗𝗮𝗿𝘁?</title>
      <dc:creator>Amr Azzam</dc:creator>
      <pubDate>Mon, 22 Jan 2024 11:49:40 +0000</pubDate>
      <link>https://dev.to/amrazzam31/--11j7</link>
      <guid>https://dev.to/amrazzam31/--11j7</guid>
      <description>&lt;p&gt;Both addAll and addEntries are methods used with maps, but they serve slightly different purposes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;𝙖𝙙𝙙𝘼𝙡𝙡:&lt;br&gt;
𝗨𝘀𝗮𝗴𝗲: addAll is used to add all key-value pairs from one map to another. It modifies the existing map.&lt;br&gt;
𝗔𝗿𝗴𝘂𝗺𝗲𝗻𝘁 𝗧𝘆𝗽𝗲: It takes a Map as an argument.&lt;br&gt;
𝗥𝗲𝘁𝘂𝗿𝗻 𝗧𝘆𝗽𝗲: void (it modifies the existing map).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;𝙖𝙙𝙙𝙀𝙣𝙩𝙧𝙞𝙚𝙨:&lt;br&gt;
𝗨𝘀𝗮𝗴𝗲: addEntries is used to create a new map by adding entries from an iterable of MapEntry objects. It does not modify the existing map but creates a new one.&lt;br&gt;
𝗔𝗿𝗴𝘂𝗺𝗲𝗻𝘁 𝗧𝘆𝗽𝗲: It takes an Iterable&amp;gt; as an argument.&lt;br&gt;
𝗥𝗲𝘁𝘂𝗿𝗻 𝗧𝘆𝗽𝗲: Map (it returns a new map).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Choose between addAll and addEntries based on whether you want to modify an existing map or create a new one with additional entries. If you want to keep the original maps unchanged and create a new map, use addEntries. If you want to modify an existing map, use addAll.&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>addall</category>
      <category>addentries</category>
    </item>
    <item>
      <title>𝗪𝗵𝗮𝘁 𝗮𝗿𝗲 𝘁𝗵𝗲 𝗥𝗲𝗴𝗘𝘅 𝗣𝗮𝘁𝘁𝗲𝗿𝗻𝘀?</title>
      <dc:creator>Amr Azzam</dc:creator>
      <pubDate>Wed, 17 Jan 2024 19:48:47 +0000</pubDate>
      <link>https://dev.to/amrazzam31/-30gi</link>
      <guid>https://dev.to/amrazzam31/-30gi</guid>
      <description>&lt;p&gt;Regular expressions (regex or RegExp) consist of a combination of characters and special symbols that define a search pattern.&lt;/p&gt;

&lt;p&gt;Here are some common patterns and symbols used in regex:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;𝙇𝙞𝙩𝙚𝙧𝙖𝙡 𝘾𝙝𝙖𝙧𝙖𝙘𝙩𝙚𝙧𝙨:&lt;br&gt;
◦ Regular characters, such as letters and digits, match themselves. For example, the pattern abc matches the string "abc" in the input.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;𝙈𝙚𝙩𝙖𝙘𝙝𝙖𝙧𝙖𝙘𝙩𝙚𝙧𝙨:&lt;br&gt;
◦ Special characters that have a specific meaning in regex. Examples include:&lt;br&gt;
▪ . (dot): Matches any single character except a newline.&lt;br&gt;
▪ ^: Anchors the regex at the start of the string.&lt;br&gt;
▪ $: Anchors the regex at the end of the string.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;𝘾𝙝𝙖𝙧𝙖𝙘𝙩𝙚𝙧 𝘾𝙡𝙖𝙨𝙨𝙚𝙨:&lt;br&gt;
◦ Enclosed in square brackets [] and match any single character within the brackets. For example, [aeiou] matches any vowel.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;𝙌𝙪𝙖𝙣𝙩𝙞𝙛𝙞𝙚𝙧𝙨:&lt;br&gt;
◦ Specify the number of occurrences of the preceding character or group. Examples include:&lt;br&gt;
▪ *: Matches 0 or more occurrences.&lt;br&gt;
▪ +: Matches 1 or more occurrences.&lt;br&gt;
▪ ?: Matches 0 or 1 occurrence.&lt;br&gt;
▪ {n}: Matches exactly n occurrences.&lt;br&gt;
▪ {n,}: Matches n or more occurrences.&lt;br&gt;
▪ {n,m}: Matches between n and m occurrences.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;𝙀𝙨𝙘𝙖𝙥𝙚 𝘾𝙝𝙖𝙧𝙖𝙘𝙩𝙚𝙧𝙨:&lt;br&gt;
◦ The backslash \ is used to escape a metacharacter, allowing it to be treated as a literal character. For example, . matches a literal dot.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;𝙂𝙧𝙤𝙪𝙥𝙞𝙣𝙜 𝙖𝙣𝙙 𝘾𝙖𝙥𝙩𝙪𝙧𝙞𝙣𝙜:&lt;br&gt;
◦ Parentheses () are used to group characters and capture the matched content. For example, (\d{2})/(\d{2})/(\d{4}) captures day, month, and year in a date pattern.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;𝘼𝙡𝙩𝙚𝙧𝙣𝙖𝙩𝙞𝙤𝙣:&lt;br&gt;
◦ The pipe | symbol is used for alternation, allowing the regex to match either of the patterns. For example, cat|dog matches either "cat" or "dog".&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;𝘾𝙝𝙖𝙧𝙖𝙘𝙩𝙚𝙧 𝙀𝙨𝙘𝙖𝙥𝙚𝙨:&lt;br&gt;
◦ Backslashes followed by certain characters represent special sequences. For example, \d matches any digit, and \s matches any whitespace character.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;𝘼𝙣𝙘𝙝𝙤𝙧𝙨:&lt;br&gt;
◦ Anchors assert a position in the string. Examples include ^ for the start of the string and $ for the end of the string.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;𝙒𝙤𝙧𝙙 𝘽𝙤𝙪𝙣𝙙𝙖𝙧𝙞𝙚𝙨:&lt;br&gt;
◦ \b is a word boundary anchor that matches the position between a word character (as defined by \w) and a non-word character.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>regex</category>
      <category>patterns</category>
    </item>
    <item>
      <title>𝗛𝗼𝘄 𝘁𝗼 𝘂𝘀𝗲 𝗥𝗲𝗴𝗘𝘅 𝗶𝗻 𝗗𝗮𝗿𝘁?</title>
      <dc:creator>Amr Azzam</dc:creator>
      <pubDate>Wed, 17 Jan 2024 07:47:53 +0000</pubDate>
      <link>https://dev.to/amrazzam31/-5a3i</link>
      <guid>https://dev.to/amrazzam31/-5a3i</guid>
      <description>&lt;p&gt;It's used to match patterns in strings, allowing you to perform more complex string manipulations, validations, and extractions.&lt;/p&gt;

&lt;p&gt;Here's a brief overview:&lt;br&gt;
1- Creating a RegExp object:&lt;br&gt;
Use the RegExp class to create a regular expression object. In Flutter, you can use this class to define patterns that you want to match.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;𝘙𝘦𝘨𝘌𝘹𝘱 𝘮𝘺𝘙𝘦𝘨𝘌𝘹𝘱 = 𝘙𝘦𝘨𝘌𝘹𝘱(𝘳'𝘱𝘢𝘵𝘵𝘦𝘳𝘯');

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The r prefix before the string literal is used to denote a raw string.&lt;/p&gt;

&lt;p&gt;2- Testing for a match:&lt;br&gt;
Use the hasMatch method to check if a string contains a match for the regular expression.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;𝘚𝘵𝘳𝘪𝘯𝘨 𝘮𝘺𝘚𝘵𝘳𝘪𝘯𝘨 = "𝘦𝘹𝘢𝘮𝘱𝘭𝘦 𝘵𝘦𝘹𝘵";
𝘪𝘧 (𝘮𝘺𝘙𝘦𝘨𝘌𝘹𝘱.𝘩𝘢𝘴𝘔𝘢𝘵𝘤𝘩(𝘮𝘺𝘚𝘵𝘳𝘪𝘯𝘨)) { 
𝘱𝘳𝘪𝘯𝘵("𝘔𝘢𝘵𝘤𝘩 𝘧𝘰𝘶𝘯𝘥!");
} 𝘦𝘭𝘴𝘦 {
𝘱𝘳𝘪𝘯𝘵("𝘕𝘰 𝘮𝘢𝘵𝘤𝘩 𝘧𝘰𝘶𝘯𝘥.");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3- Finding matches:&lt;br&gt;
Use the allMatches method to find all matches in a given string.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;𝘚𝘵𝘳𝘪𝘯𝘨 𝘮𝘺𝘚𝘵𝘳𝘪𝘯𝘨 = "𝘦𝘹𝘢𝘮𝘱𝘭𝘦 𝘵𝘦𝘹𝘵 𝘸𝘪𝘵𝘩 𝘱𝘢𝘵𝘵𝘦𝘳𝘯 𝘱𝘢𝘵𝘵𝘦𝘳𝘯";
𝘓𝘪𝘴𝘵&amp;lt;𝘔𝘢𝘵𝘤𝘩&amp;gt; 𝘮𝘢𝘵𝘤𝘩𝘦𝘴 = 𝘮𝘺𝘙𝘦𝘨𝘌𝘹𝘱.𝘢𝘭𝘭𝘔𝘢𝘵𝘤𝘩𝘦𝘴(𝘮𝘺𝘚𝘵𝘳𝘪𝘯𝘨);
𝘧𝘰𝘳 (𝘔𝘢𝘵𝘤𝘩 𝘮𝘢𝘵𝘤𝘩 𝘪𝘯 𝘮𝘢𝘵𝘤𝘩𝘦𝘴) { 
𝘱𝘳𝘪𝘯𝘵("𝘔𝘢𝘵𝘤𝘩 𝘧𝘰𝘶𝘯𝘥 𝘢𝘵 ${𝘮𝘢𝘵𝘤𝘩.𝘴𝘵𝘢𝘳𝘵} - ${𝘮𝘢𝘵𝘤𝘩.𝘦𝘯𝘥}: ${𝘮𝘢𝘵𝘤𝘩.𝘨𝘳𝘰𝘶𝘱(0)}");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4- Extracting matched groups:&lt;br&gt;
If your regular expression contains groups, you can access them using the group method of the Match object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;𝘙𝘦𝘨𝘌𝘹𝘱 𝘮𝘺𝘙𝘦𝘨𝘌𝘹𝘱 = 𝘙𝘦𝘨𝘌𝘹𝘱(𝘳'(\𝘥{2})/(\𝘥{2})/(\𝘥{4})');
𝘚𝘵𝘳𝘪𝘯𝘨 𝘥𝘢𝘵𝘦𝘚𝘵𝘳𝘪𝘯𝘨 = "01/17/2024";
𝘔𝘢𝘵𝘤𝘩 𝘮𝘢𝘵𝘤𝘩 = 𝘮𝘺𝘙𝘦𝘨𝘌𝘹𝘱.𝘧𝘪𝘳𝘴𝘵𝘔𝘢𝘵𝘤𝘩(𝘥𝘢𝘵𝘦𝘚𝘵𝘳𝘪𝘯𝘨);
𝘪𝘧 (𝘮𝘢𝘵𝘤𝘩 != 𝘯𝘶𝘭𝘭) { 
𝘚𝘵𝘳𝘪𝘯𝘨 𝘥𝘢𝘺 = 𝘮𝘢𝘵𝘤𝘩.𝘨𝘳𝘰𝘶𝘱(1);
 𝘚𝘵𝘳𝘪𝘯𝘨 𝘮𝘰𝘯𝘵𝘩 = 𝘮𝘢𝘵𝘤𝘩.𝘨𝘳𝘰𝘶𝘱(2);
 𝘚𝘵𝘳𝘪𝘯𝘨 𝘺𝘦𝘢𝘳 = 𝘮𝘢𝘵𝘤𝘩.𝘨𝘳𝘰𝘶𝘱(3);
 𝘱𝘳𝘪𝘯𝘵("𝘋𝘢𝘵𝘦: $𝘮𝘰𝘯𝘵𝘩/$𝘥𝘢𝘺/$𝘺𝘦𝘢𝘳");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5- Testing in a Flutter application:&lt;br&gt;
You can use regular expressions in various scenarios in Flutter, such as form validations, parsing data, or filtering lists. For example, you might use a regular expression to validate an email address entered in a form.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;𝘙𝘦𝘨𝘌𝘹𝘱 𝘦𝘮𝘢𝘪𝘭𝘙𝘦𝘨𝘌𝘹𝘱 = 𝘙𝘦𝘨𝘌𝘹𝘱(𝘳'^[\𝘸-]+(\.[\𝘸-]+)*@([\𝘸-]+\.)+[𝘢-𝘻𝘈-𝘡] {2,7}$');
𝘚𝘵𝘳𝘪𝘯𝘨 𝘦𝘮𝘢𝘪𝘭𝘈𝘥𝘥𝘳𝘦𝘴𝘴 = "𝘦𝘹𝘢𝘮𝘱𝘭𝘦@𝘦𝘮𝘢𝘪𝘭.𝘤𝘰𝘮";
𝘪𝘧 (𝘦𝘮𝘢𝘪𝘭𝘙𝘦𝘨𝘌𝘹𝘱.𝘩𝘢𝘴𝘔𝘢𝘵𝘤𝘩(𝘦𝘮𝘢𝘪𝘭𝘈𝘥𝘥𝘳𝘦𝘴𝘴)) {
𝘱𝘳𝘪𝘯𝘵("𝘝𝘢𝘭𝘪𝘥 𝘦𝘮𝘢𝘪𝘭 𝘢𝘥𝘥𝘳𝘦𝘴𝘴");
} 𝘦𝘭𝘴𝘦 {
 𝘱𝘳𝘪𝘯𝘵("𝘐𝘯𝘷𝘢𝘭𝘪𝘥 𝘦𝘮𝘢𝘪𝘭 𝘢𝘥𝘥𝘳𝘦𝘴𝘴");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;𝙒𝙖𝙞𝙩 𝙛𝙤𝙧 𝙩𝙝𝙚 𝙋𝙖𝙩𝙩𝙚𝙧𝙣𝙨 𝙤𝙛 𝙍𝙚𝙜𝙀𝙭 𝙥𝙤𝙨𝙩 🚀&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>regex</category>
    </item>
  </channel>
</rss>
