working on

This commit is contained in:
Thomas Atkins 2021-04-10 14:48:24 -05:00
parent d41d026448
commit 5b8922e68a
2 changed files with 29 additions and 2 deletions

View File

@ -16,7 +16,9 @@ class BluetoothPage extends StatefulWidget {
} }
class _BluetoothPageState extends State<BluetoothPage> { class _BluetoothPageState extends State<BluetoothPage> {
final id = SharedPreferences.getInstance().then((s) => s.getString('id')); // final String id = getId();
// String getId() =>
// SharedPreferences.getInstance().then((s) => s.getString('id') ?? '0');
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -25,8 +27,23 @@ class _BluetoothPageState extends State<BluetoothPage> {
title: Text(widget.title), title: Text(widget.title),
), ),
body: Center( body: Center(
child: Text('$id'), child: ElevatedButton(
child: Text("GetID"),
onPressed: () async {
final prefs = await SharedPreferences.getInstance();
final id = prefs.getString('id');
ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: Text("Id is $id")));
},
),
), ),
); );
} }
void showSnackbar(dynamic a) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(a.toString()),
));
}
} }

View File

@ -0,0 +1,10 @@
import 'dart:io';
import 'dart:math';
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:nearby_connections/nearby_connections.dart';
import 'package:shared_preferences/shared_preferences.dart';
class Connect {}