devappsdk2 1.0.2 copy "devappsdk2: ^1.0.2" to clipboard
devappsdk2: ^1.0.2 copied to clipboard

PlatformAndroid

A Flutter package support share data between multiple application via content provider.

example/lib/main.dart

import 'package:devappsdk2/devappsdk.dart';
import 'package:flutter/material.dart';
import 'package:kdialogs/kdialogs.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Example',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const Home(),
    );
  }
}

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

  @override
  State<Home> createState() => _HomeState();
}

class _HomeState extends State<Home> {
  String input = "preferencias.server";
  String text = "";

  @override
  void initState() {
    void read() async {
      final value = await DevAppManager().readValue("preferencias.server");
      print(value);
      final value2 = await DevAppManager().readValue("preferencias.server");
      print(value2);
    }

    WidgetsBinding.instance.addPostFrameCallback((_) async {
      read.call();
    });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            SizedBox(
              width: 200,
              child: TextFormField(
                initialValue: input,
                decoration: const InputDecoration(label: Text("Name")),
                onChanged: (value) => input = value,
              ),
            ),
            IconButton(
              onPressed: () async {
                try {
                  final value = await DevAppManager().readValue("preferencias.server");
                  print(value);
                  final value2 = await DevAppManager().readValue("preferencias.server");
                  print(value2);
                  final value3 = await DevAppManager().readValue(input);
                  setState(() {
                    text = value3 ?? "not-found";
                  });
                } catch (err) {
                  if (!context.mounted) return;
                  showBottomAlertKDialog(context, message: err.toString());
                }
              },
              icon: const Icon(Icons.search),
            ),
            const SizedBox(height: 20.0),
            Text(text),
          ],
        ),
      ),
    );
  }
}
0
likes
140
points
42
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package support share data between multiple application via content provider.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, http, plugin_platform_interface

More

Packages that depend on devappsdk2