A flutter framework for storage, navigator, validate manager, we made flutter easy and fast.
- About Devi
- Object creating
- Route Management
- Disk Storage
- Snackbar and Alert
- Copy to clipboard
- Validator
Devi is a fast and light framework for flutter to make work easy, its make management fast. Devi has very easy code and clean code to understand for beginner and all. Its allow to management for route, disk storage, alerts and validation.
Before using user have to intilize object for class DEVI.
Devi devi = new Devi();
When want to use disk storage.
Devi box1 = new Devi('box1');
Devi box2 = new Devi('box2');
If you want to navigate to another screen, so here we use the route management to jump to another screen.
devi.route(context,MyApp());
It will create route to screen MyApp. For going back from current screen to previous screen, here we use back() method
devi.back();
It will route to you previous screen.
Disk storage is use to create disk variable as cache in your application. which is permanently created in system till formating device. Its very light to use and based on JSON.
To write or creating new storage variable here we use method put()
Devi devi = new Devi('box1'); //box1 is parent storage name
devi.put('name','Rohit');
It will write Rohit as key name
in box1
, and store to the disk.
For reading a existing disk storage we use get() method
devi.get('name');
It will return value of key name
.
For checking is variable is available or not in disk.
devi.isHas('name'); //will return true or false
Another example
if(devi.isHas('name') == true){
print('Yes, key is found');
} else {
print('No, key not found');
}
For clear specific key from storage we use remove() method
devi.remove('name');
It will remove name key from storage.
For getting all stored value from box, here we use getJson() method
Devi devi = new Devi('box1');
devi.put('name','Rohit');
devi.put('county','India');
devi.getJson();
will return
{
"name":"Rohit",
"country":"India"
}
For clearing all disk variable here we use clean method.
devi.clean();
Snackbar and alert is use to create a pop information in application.
for creating snackbar on application here we have method toast()
devi.toast(context,
title: "Hello, I am SnackBar",
buttonLabel: "Ok",
onPressed: () {
print("SnackBar Clicked!");
});
for applying theme on snackbar we use theme properties
devi.toast(context,
theme: Colors.red, //background color
buttonTheme: Colors.white, //button color
title: "Hello, I am SnackBar",
buttonLabel: "Ok",
onPressed: () {
print("SnackBar Clicked!");
});
To show pop up dialogbox here we use alert() method
devi.alert(context,
title: "Heading",
description: "This is Alert Box",
actions: [
TextButton(onPressed: () => Navigator.of(context).pop(), child: Text("Ok"))
]);
When you want to copy and text in clipboard here we use copy() method
String text = "Hello, I am devi!";
devi.copy(text);
devi.paste(); // will return copied txt
It will copy text to your system clipboard.
There is some string validator to validate email, strong password etc.
String email = "abc@gmail.com";
if(devi.isEmail(email) == true){
print("Email is valid");
} else {
print("Email is not valid");
}
String password = "Qwerty@123";
if(devi.isPassword(password) == true){
print("Password is strong");
} else {
print("Password is weak");
}
String website = "http://google.com";
if(devi.isUrl(website) == true){
print("URL is strong");
} else {
print("URL is weak");
}
👉 For a complete example, refer to the Devi package documentation.
You are welcome to open a ticket on github if any 🐞 problems arise. New ideas are always welcome.
Copyright © 2024 Rohit Chouhan. Licensed under the MIT LICENSE