// Obtain shared preferences.
final prefs = await SharedPreferences.getInstance();

Navigator.pop()

1st screen

void goToSecondScreen()async {
var result = await Navigator.push(_context, new MaterialPageRoute(
builder: (BuildContext context) => new SecondScreen(context),
fullscreenDialog: true,)
);
Scaffold.of(_context).showSnackBar(SnackBar(content: Text("$result"),duration: Duration(seconds: 3),));
}

2nd screen

Navigator.pop(context, "Hello world");

Time

timestamp

void main() {
print(DateTime.now().millisecondsSinceEpoch);
}

from timestamp

var date = DateTime.fromMillisecondsSinceEpoch(timestamp);date.toLocal();

--

--

Stack(
alignment: Alignment.center,
textDirection: TextDirection.rtl,
fit: StackFit.loose,
overflow: Overflow.visible,
clipBehavior: Clip.hardEdge,
children: <Widget>[]
),

gradient

gradient: LinearGradient(
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: [
Colors.blue,
Colors.red,
],
)

Tabbar

DefaultTabController(
length: 3,
child: Scaffold(
appBar: AppBar(
bottom: TabBar(
tabs: [
Tab(icon: Icon(Icons.flight)),
Tab(icon: Icon(Icons.directions_transit)),
Tab(icon: Icon(Icons.directions_car)),
],
),
title: Text('Tabs Demo'),
),
body: TabBarView(
children: [
Icon(Icons.flight, size: 350),
Icon(Icons.directions_transit, size: 350),
Icon(Icons.directions_car, size: 350),
],
),
),
);

alert box

showAlertDialog(BuildContext context,{topic,description,onCancel,onContinue}) {
// set up the buttons
Widget cancelButton = TextButton(
child: Text("Cancel"),
onPressed: onCancel,
);
Widget continueButton = TextButton(
child: Text("Continue"),
onPressed: onContinue,
);
// set up the AlertDialog
AlertDialog alert = AlertDialog(
title: Text(topic),
content: Text(description),
actions: [
cancelButton,
continueButton,
],
);
// show the dialog
showDialog(
context: context,
builder: (BuildContext context) {
return alert;
},
);
}

--

--

https://www.geeksforgeeks.org/node-js-puppeteer/

npm install puppeteer --saveconst puppeteer = require('puppeteer');(async () => {
const browser = await puppeteer.launch({headless: false});
const page = await browser.newPage();
await page.goto('https://www.google.com/');

await browser.close();
})();

Taking screenshot

const puppeteer = require('puppeteer');(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://www.google.com/');
await page.screenshot({ path: 'GFG.png' });
await browser.close();
})();

Headless

const puppeteer = require('puppeteer');(async () => {
const browser = await puppeteer.launch({
headless: true,
defaultViewport: null
});
const page = await browser.newPage();
await page.goto('https://www.google.com/');

await browser.close();
})();

souravmandalm@gmail.com

--

--

sourav mandal

sourav mandal

just a coder who forgets things so makes blogs so he can remember later