super_shared_preferences 0.0.2 copy "super_shared_preferences: ^0.0.2" to clipboard
super_shared_preferences: ^0.0.2 copied to clipboard

Shared library that can read and write data on Android SharedPres files with SharedName.

example/lib/main.dart

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

import 'package:shared_preferences/super_shared_preferences.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String value = "";

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    SharedPreferences.instance(sharedName: "newName")
        .setValue("key", "testKey");
    String val = await SharedPreferences.instance().getValue("key");

    if (!mounted) return;

    setState(() {
      value = val;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('getValue,value=$value'),
        ),
      ),
    );
  }
}
0
likes
25
pub points
0%
popularity

Publisher

unverified uploader

Shared library that can read and write data on Android SharedPres files with SharedName.

Repository (GitHub)
View/report issues

License

Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on super_shared_preferences