<?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>Forem: SinachPat</title>
    <description>The latest articles on Forem by SinachPat (@sinachpat).</description>
    <link>https://forem.com/sinachpat</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%2F336059%2Ff10a5cd1-c15c-4020-a833-8dd6e55adb51.jpg</url>
      <title>Forem: SinachPat</title>
      <link>https://forem.com/sinachpat</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/sinachpat"/>
    <language>en</language>
    <item>
      <title>POKT Token: History and DePIN tokenomics</title>
      <dc:creator>SinachPat</dc:creator>
      <pubDate>Thu, 06 Jun 2024 11:21:14 +0000</pubDate>
      <link>https://forem.com/sinachpat/pokt-token-history-and-depin-tokenomics-l83</link>
      <guid>https://forem.com/sinachpat/pokt-token-history-and-depin-tokenomics-l83</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp4aqfmh97o71f8qn6nkf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp4aqfmh97o71f8qn6nkf.png" alt="POKT Token Guide Visuals" width="800" height="467"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;You and I will agree that blockchain is no longer a new story in town; it is here to stay, probably forever, and has received a lot of interest.&lt;/p&gt;

&lt;p&gt;But if you’re new to it, blockchain is a decentralized and secure digital ledger used to record transactions. It is typically public, allowing anyone to view them to establish transparency and trust within the system.&lt;/p&gt;

&lt;p&gt;Blockchain technology has also greatly impacted various industries with its decentralized and secure approach.&lt;/p&gt;

&lt;p&gt;However, of course, there will always be problems and challenges that go beyond just how beautiful and sweet it may sound. Two among them are scalability and infrastructure costs.&lt;/p&gt;

&lt;p&gt;Because of the attraction blockchain has gotten in recent years, this has led to congestion, especially during the transaction process. As more users join the network, things can slow down. This is because blockchains can only handle a certain amount of activity at a time, and it has become a major challenge for blockchains. It makes them less suitable for applications that need things to happen fast.&lt;/p&gt;

&lt;p&gt;Also, setting up and maintaining blockchain infrastructure can be really expensive for application developers.&lt;/p&gt;

&lt;p&gt;This is where the POKT Network comes in as a solution to these challenges by providing a decentralized network for relaying blockchain traffic. POKT Network offers high-performance and low-cost infrastructure for developers to build and scale their blockchain applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the POKT Token?
&lt;/h2&gt;

&lt;p&gt;POKT Network is a blockchain network specifically designed for Web3 applications. It operates as the RPC (Remote Procedure Call) Base Layer in the Web3 infrastructure, contributing to a dependable, cost-effective, and high-uptime solution for data access and management while ensuring its decentralized nature.&lt;/p&gt;

&lt;p&gt;POKT Network offers low latency and high accuracy in data handling, connecting data transfer between different blockchains through two major players: a network of thousands of computers (nodes) and the application. The nodes are used for storing data and communicating information.&lt;/p&gt;

&lt;p&gt;The POKT Network uses a native token called POKT. This token serves an important role in incentivizing various participants within the network and creating a stronger and more secure blockchain network. By holding and utilizing POKT tokens, users contribute to the network's functionality and its overall growth.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Cases of POKT Token
&lt;/h2&gt;

&lt;p&gt;We will categorise POKT into 4 use cases:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjlhj4mzk6fw7704647f9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjlhj4mzk6fw7704647f9.png" alt="Image description" width="800" height="250"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;For staking&lt;/strong&gt;: This process involves locking up a certain amount of POKT tokens for a specified period as a means of supporting the network and participating in its operations. In return for securing the blockchain and processing transactions, POKT stakers are rewarded with additional Pocket Network tokens, $POKT. Staking greatly contributes to the security, transparency, and stability of the network. The more a user stakes, the more rewards they get, and the more voting power they hold, allowing them to participate in network governance decisions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;For Developers&lt;/strong&gt;: A simplified process has been created for developers to integrate their applications with decentralized node infrastructure. This grants them access to cost-effective infrastructure, allowing them to request, retrieve, and store data essential for blockchain-enabled application development without managing expensive nodes. Developers can access Pocket's open-source code and make contributions to the community.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;For node runners&lt;/strong&gt;: The node runners act as infrastructure providers for the POKT Network. They play a major part in being a big intersection for Web3 applications, linking different blockchains using thousands of computers also run by node runners, and connecting developers in need of blockchain-enabled applications with infrastructure providers operating full nodes, known as Service Nodes. All the work in this Pocket Network boils down to relays, where apps send requests and Service Nodes check them on different blockchains. When it's verified that a task has been done, these node runners are compensated with POKT tokens for providing access to reliable blockchain application programming interfaces (APIs).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Holders&lt;/strong&gt;: Community members and contributors can get POKT tokens as rewards for contributing to the foundation and making an impact in the ecosystem, governance of the community, and the protocol. These people grow their holdings by continuous impact and are called POKT Holders.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  DePIN Tokenomics
&lt;/h2&gt;

&lt;p&gt;The focal points of blockchain have always been transparency, decentralization, scalability, and verifiable infrastructure. DePIN, which stands for Decentralized Physical Infrastructure Networks, takes these principles and applies them to the real world. In the POKT Network, DePIN represents a significant advancement in how blockchain technology can manage and scale physical infrastructure such as communication networks, the energy grid, and transportation systems using the decentralized and scalable model.&lt;/p&gt;

&lt;p&gt;DePIN offers incentives for resource contributions for specific actions within the network operations, such as data delivery and arbitration. In DePIN, participants contribute physical assets such as data storage, wireless connectivity, sensors, or energy grids. In exchange, they receive rewards based on the network’s incentive structure. DePIN platforms enable decentralized sharing and management of both hardware and software resources among users. One of the most important roles of DePIN is ensuring the security and efficiency of physical infrastructure by removing single points of failure and reducing the risks of tampering or manipulation. Data exchanges are protected by cryptography, and the distributed database guards against attacks or unauthorized access.&lt;/p&gt;

&lt;p&gt;As blockchain continues to gain traction every single day, there will always be a demand for an efficient and scalable network, and POKT, I believe, stands in a position to address this growing need by offering effective solutions. The continuous and ongoing development of this network definitely holds promise and its future looks bright both in its integration and protocol enhancement.&lt;/p&gt;

&lt;h2&gt;
  
  
  Additional information
&lt;/h2&gt;

&lt;p&gt;For more read on POKT and how far this project is going, you might have to check out this links below&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;POKT Network Website: &lt;a href="https://www.pokt.network/"&gt;https://www.pokt.network/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;What is DePIN: &lt;a href="https://medium.com/bru-finance/what-is-depin-decentralized-physical-infrastructure-network-9cd4247db608"&gt;https://medium.com/bru-finance/what-is-depin-decentralized-physical-infrastructure-network-9cd4247db608&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;POKT overview: &lt;a href="https://messari.io/project/pocket-network-2/profile"&gt;https://messari.io/project/pocket-network-2/profile&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;POKT for Developers: &lt;a href="https://www.pokt.network/blog/pocket-core-mvp-for-developers"&gt;https://www.pokt.network/blog/pocket-core-mvp-for-developers&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;What is POKT staking: &lt;a href="https://docs.pokt.network/pokt-token/stake-pokt"&gt;https://docs.pokt.network/pokt-token/stake-pokt&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Look forward to the next post in the series about the POKT token in the Shannon Era.&lt;/p&gt;

</description>
      <category>depin</category>
      <category>web3</category>
      <category>tokenomics</category>
    </item>
    <item>
      <title>Dart - Variables &amp; Challenges</title>
      <dc:creator>SinachPat</dc:creator>
      <pubDate>Tue, 04 Apr 2023 21:37:48 +0000</pubDate>
      <link>https://forem.com/sinachpat/dart-variables-challenges-10ef</link>
      <guid>https://forem.com/sinachpat/dart-variables-challenges-10ef</guid>
      <description>&lt;p&gt;This is the beginning of a series on Dart/Flutter that will have me sharing bits of Dart/Flutter every now and then on the fundamentals of building cross-platform applications using the language and framework. The purpose of this is to provide a summarized reference for the Flutter Roadmap which shows a path for learning Flutter towards mastery. I’ll provide this content with well-commented codes so beginners will be able to make references to these resources and not just learn about the Dart/Flutter language but really understand how it works.&lt;/p&gt;

&lt;p&gt;Every programming language has a way of storing values, objects and methods. In Dart, variables are a way of storing values. These values can be called References. You can always use the value of the variable by calling on the variable.&lt;/p&gt;

&lt;p&gt;Variables in Dart are defined with the type clearly indicated as String, Object, Int, bool etc.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Here a variable is defined with name as myFirstName which stores 

// my first name which is Osinachi 

String myFirstName = "Osinachi";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bool confirmName = true;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can use the variable type Object for variables that can have changing values. For example you can define a value to be a String and later change it to be an Int depending on the flow of the program.&lt;/p&gt;

&lt;p&gt;When defining a variable which value can be Null, the code should be able to show the bear a question mark which ensures that the code doesn’t throw an error when used later in the program and a state in the program assigns it a null value. The format for defining a &lt;strong&gt;nullable&lt;/strong&gt; value in Dart/Flutter is shown below.&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;
//the assert here confirms that this variable can be null throughout the program
assert(age == null);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;String? chainName;
//the assert here confirms that this variable can be null throughout the program
assert(chainName == null);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Late Variables
&lt;/h2&gt;

&lt;p&gt;If you declare a non-nullable variable and wish not to assign in a value at the initial declaration, the late modifier is used to tell the program “Hey, this is a value store in this program. I would be using it later to store a value so just keep it for me as &lt;strong&gt;late&lt;/strong&gt;.”&lt;/p&gt;

&lt;p&gt;In programming, variables are used to store values or objects. In Dart, variables are defined with the type clearly indicated as String, Object, Int, bool, and others. When you declare a variable, you must assign a value to it immediately. However, there are instances when you need to declare a variable but do not wish to assign a value to it immediately. This is where the &lt;code&gt;late&lt;/code&gt; modifier comes in handy.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;late&lt;/code&gt; modifier is used to defer the initialisation of a non-nullable variable until it is accessed for the first time. This is useful when you need to declare a variable that will be assigned a value later in the program, but you don't want to initialise it with a dummy value at the time of declaration. This can help to make your code more efficient and easier to read.&lt;/p&gt;

&lt;p&gt;For example, if you have a variable that will be initialised with the result of an asynchronous operation, you can declare it as a &lt;code&gt;late&lt;/code&gt; variable to avoid having to initialise it with a default value that will be immediately replaced. Instead, you can simply declare it as &lt;code&gt;late&lt;/code&gt; and assign a value to it later in the program. This can help to reduce clutter in your code and make it easier to understand.&lt;/p&gt;

&lt;p&gt;It's worth noting that &lt;code&gt;late&lt;/code&gt; variables must be initialised before they are accessed, or an exception will be thrown. This means that you should be careful when using &lt;code&gt;late&lt;/code&gt; variables to ensure that they are initialised correctly and in a timely manner. If you attempt to access a &lt;code&gt;late&lt;/code&gt; variable before it has been initialised, your program will throw an exception, which can cause your program to crash or behave unexpectedly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;late String nameHint;

//Here the variable is now initialized and assigned a value.

void main() {
String nameHint = "Os";
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;While this is for variable declarations you would want to change later, there are variables we use in our program that we wish to declare just once and not change again. We would talk about constants and finals in the next section.&lt;/p&gt;

&lt;h2&gt;
  
  
  Const and Final Variables
&lt;/h2&gt;

&lt;p&gt;You can define variables you don’t want to change throughout the program with the keywords &lt;code&gt;final or const.&lt;/code&gt; This stores values permanently in a program that can’t be changed anywhere in the program.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const String nameHint = "Os";
final String fullName = "Osinachi Patrick"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can use final in Instance Variables (variables declared within a class) for representing values that can’t change.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Person {
  String? firstName; // Declare instance variable x, initially null.
  String? lastName; // Declare y, initially null.
  final int age = 21; // Declare z, initially 0.
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In summary, we use variables in many instances in our programs and it’s important we understand how it works fundamentally.&lt;/p&gt;

&lt;p&gt;To understand the concept of variables more deeply, let’s have some challenges to work on.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lZFyqSje--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z0nf308s15xlhfl6771e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lZFyqSje--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z0nf308s15xlhfl6771e.png" alt="Challenge for the course" width="880" height="838"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;See you in my next article 💙&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>variables</category>
    </item>
    <item>
      <title>Generate Random Password for users in your App — Building with Flutter</title>
      <dc:creator>SinachPat</dc:creator>
      <pubDate>Fri, 03 Mar 2023 16:28:24 +0000</pubDate>
      <link>https://forem.com/sinachpat/generate-random-password-for-users-in-your-app-building-with-flutter-2jfl</link>
      <guid>https://forem.com/sinachpat/generate-random-password-for-users-in-your-app-building-with-flutter-2jfl</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iuGSuXIU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/asyvtublvud17r6v3gfn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iuGSuXIU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/asyvtublvud17r6v3gfn.png" alt="This image displays the topic of the tutorial" width="880" height="531"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Security is one of the important features that are built into any mobile app where users have to create an account before interacting with the able and using it’s other features. From experience the process of creating an account password has been something people do without sometimes giving some deep thoughts. Some users create their own password while some prefer to get a suggestion of a strong password from the app.&lt;/p&gt;

&lt;p&gt;The purpose of a password in an app is for &lt;strong&gt;user account security.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let me take some lines to explain the concept of &lt;strong&gt;user account security.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  User Account Security
&lt;/h2&gt;

&lt;p&gt;User account security refers to the protection of user accounts from unauthorised access, misuse, and abuse. It is essential to ensure that only authorised users have access to sensitive information, systems, and applications. Here are some key concepts to understand when it comes to user account security:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Passwords:&lt;/strong&gt; A password is a secret combination of characters that a user must provide to access their account. Passwords should be strong, unique, and regularly changed to prevent unauthorised access. Users should avoid sharing their passwords with others and never use the same password across multiple accounts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Two-Factor Authentication (2FA):&lt;/strong&gt; 2FA is a security mechanism that requires users to provide two different types of authentication factors before they can access their account. This typically involves a password and a secondary factor, such as a fingerprint or a one-time code sent via SMS or email.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Access Controls:&lt;/strong&gt; Access controls are mechanisms that limit who can access certain resources or information. Access controls can include things like user roles, permissions, and restrictions based on location or device.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitoring:&lt;/strong&gt; Monitoring is the process of tracking user activity to detect potential security threats. This can include monitoring login attempts, user behavior, and system logs to identify suspicious activity and potential security breaches.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Education and Training:&lt;/strong&gt; Education and training are crucial components of user account security. Users need to understand the risks of insecure practices such as weak passwords, phishing scams, and malware attacks. Organizations should provide regular training and awareness campaigns to ensure that users are aware of these risks and know how to avoid them.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Overall, user account security is an ongoing process that requires a combination of technical controls, policies, and user education. By implementing best practices and staying vigilant, organisations can help protect their users and sensitive information from potential security threats.&lt;/p&gt;

&lt;p&gt;In the rest of this tutorial I’ll be looking at guiding the reader through a simple way of baking in app generated random characters which the user can use as their account password. This is tutorial would be relevant to you if you are building with Flutter (with Dart Programming Language).&lt;/p&gt;

&lt;h2&gt;
  
  
  Basic Requirements
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Knowledge of Dart Programming Language.&lt;/li&gt;
&lt;li&gt;Have Dart/Flutter installed using this &lt;a href="https://www.youtube.com/watch?v=Z2ugnpCQuyw&amp;amp;t=4s"&gt;video (this is a series, so follow through).&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;A windows laptop of minimum 4GB RAM for running your Android studio or making use of &lt;a href="https://dartpad.dev/?"&gt;DartPad.&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I won't be writing on how to setup Dart/Flutter in your PC because this article would be too long to have that and the main tutorial of the article. So let's get down to &lt;strong&gt;writing a program that can help you generate random password for your users.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For first time test, The next thing to do is to create a new flutter project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flutter create random-password
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates the well structure flutter project file where you have to locate your &lt;strong&gt;lib&lt;/strong&gt; folder to write your first codes to test the solution on your own PC.&lt;/p&gt;

&lt;p&gt;While solving some problems using Dart we need some libraries that help you build on some specific features of the language like &lt;a href="https://api.dart.dev/stable/2.19.3/dart-math/dart-math-library.html"&gt;dart:maths&lt;/a&gt;, &lt;a href="https://api.dart.dev/stable/2.19.3/dart-core/dart-core-library.html"&gt;dart:core&lt;/a&gt; etc.&lt;/p&gt;

&lt;p&gt;In this program we will be importing the Dart library for maths operation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'dart:math';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This imports the Dart maths library: It helps you in using Mathematical constants and functions, plus a random number generator.&lt;/p&gt;

&lt;p&gt;The next thing we have to do is to go under this block of code in your lib folder &lt;strong&gt;main.dart&lt;/strong&gt; file and add a new function for your solution.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import 'package:flutter/material.dart';
import 'dart:math';

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

// Add your own function here.
void testPassword() {

}

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

&lt;/div&gt;



&lt;p&gt;This makes it possible for you to easily call your &lt;code&gt;testPassword()&lt;/code&gt; function in the application root. This way in your code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    testPassword();
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

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

&lt;/div&gt;



&lt;p&gt;You call the &lt;code&gt;testPassword()&lt;/code&gt; function within the &lt;code&gt;build()&lt;/code&gt; this logs your program result to the debug console when you run your code in Debugging mode.&lt;/p&gt;

&lt;p&gt;Let's write the core program for generating the random password, I'd do a breakdown of each line of the code.&lt;/p&gt;

&lt;p&gt;We need to first declare the number of characters the password should be and this would be constant for all generated passwords.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const int passwordLength = 20;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We then provide the program with some characters to choose from in generating the random password:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const String digits = 'StanruteTechnologies0123456789!@#\$%^&amp;amp;*()_-+={}[]|;:,.&amp;lt;&amp;gt;?';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we go ahead and write the main code go generate the random password, here we make use of the different methods the &lt;code&gt;dart:math&lt;/code&gt; library provides like &lt;code&gt;Random()&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Random random = Random();
  String password = '';
  for (int i = 0; i &amp;lt; passwordLength; i++) {
    password += digits[random.nextInt(digits.length)];
}

// To print your random password to the debug console.
print(password);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After this you can run the &lt;code&gt;main.dart&lt;/code&gt; file to keep generating multiple random passwords.&lt;/p&gt;

&lt;p&gt;Bring the whole code together we have something that looks like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IM_-tZNt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3791l5gsviuvk4yb5frk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IM_-tZNt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3791l5gsviuvk4yb5frk.png" alt="This is summarized code block for the article" width="880" height="1165"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is written in a beginner friendly manner but any further questions can be directed to me &lt;a href="https://twitter.com/sinachpatrick"&gt;here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for Reading 💙&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>mobile</category>
      <category>security</category>
    </item>
  </channel>
</rss>
