d_session 0.0.1 copy "d_session: ^0.0.1" to clipboard
d_session: ^0.0.1 copied to clipboard

Easy way to access Shared Preference and use as Session.

example/lib/main.dart

// import 'package:d_session/d_session.dart';
// import 'package:flutter/material.dart';

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

// class MyApp extends StatelessWidget {
//   const MyApp({super.key});

//   @override
//   Widget build(BuildContext context) {
//     return const MaterialApp(
//       debugShowCheckedModeBanner: false,
//       home: Home(),
//     );
//   }
// }

// class Home extends StatelessWidget {
//   const Home({super.key});

//   @override
//   Widget build(BuildContext context) {
//     return Scaffold(
//       appBar: AppBar(
//         title: const Text('Test D Session'),
//         centerTitle: true,
//       ),
//       body: ListView(
//         padding: const EdgeInsets.all(16),
//         children: [
//           const ListTile(title: Text('Custom')),
//           Row(
//             mainAxisAlignment: MainAxisAlignment.spaceBetween,
//             children: [
//               ElevatedButton(
//                 onPressed: () {
//                   DSession.setCustom('isDark', true);
//                 },
//                 child: const Text('Save'),
//               ),
//               ElevatedButton(
//                 onPressed: () async {
//                   final data = await DSession.getCustom('isDark');
//                   debugPrint(data.toString());
//                 },
//                 child: const Text('Get'),
//               ),
//               ElevatedButton(
//                 onPressed: () {
//                   DSession.removeCustom('isDark');
//                 },
//                 child: const Text('Remove'),
//               ),
//             ],
//           ),
//           const ListTile(title: Text('User')),
//           Row(
//             mainAxisAlignment: MainAxisAlignment.spaceBetween,
//             children: [
//               ElevatedButton(
//                 onPressed: () {
//                   Map user = {
//                     'id': 'aha276avsUHUa',
//                     'email': 'flutter_d_lux@gmail.com',
//                     'username': 'indre',
//                   };
//                   DSession.setUser(user);
//                 },
//                 child: const Text('Save'),
//               ),
//               ElevatedButton(
//                 onPressed: () {
//                   DSession.getUser().then((value) {
//                     debugPrint(value.toString());
//                     if (value != null) {
//                       debugPrint(value['email']);
//                     }
//                   });
//                 },
//                 child: const Text('Get'),
//               ),
//               ElevatedButton(
//                 onPressed: () {
//                   DSession.removeUser();
//                 },
//                 child: const Text('Remove'),
//               ),
//             ],
//           ),
//           const ListTile(title: Text('Token')),
//           Row(
//             mainAxisAlignment: MainAxisAlignment.spaceBetween,
//             children: [
//               ElevatedButton(
//                 onPressed: () {
//                   Map data = {
//                     'token': 'askuaysuabs',
//                     'expire': '2023-10-10 01:01:01',
//                   };
//                   DSession.setToken(data);
//                 },
//                 child: const Text('Save'),
//               ),
//               ElevatedButton(
//                 onPressed: () {
//                   DSession.getToken()
//                       .then((value) => debugPrint(value.toString()));
//                 },
//                 child: const Text('Get'),
//               ),
//               ElevatedButton(
//                 onPressed: () {
//                   DSession.removeToken();
//                 },
//                 child: const Text('Remove'),
//               ),
//             ],
//           ),
//         ],
//       ),
//     );
//   }
// }
0
likes
0
points
61
downloads

Publisher

verified publisherindratrisnar.com

Weekly Downloads

Easy way to access Shared Preference and use as Session.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, shared_preferences

More

Packages that depend on d_session