diff options
author | xAlpharax <42233094+xAlpharax@users.noreply.github.com> | 2023-11-05 05:24:13 +0200 |
---|---|---|
committer | xAlpharax <42233094+xAlpharax@users.noreply.github.com> | 2023-11-05 05:24:13 +0200 |
commit | 29e9e7f1e428ef946ca8cd46fdd891efb659f98c (patch) | |
tree | b617226c34f07834ac319e5012402df9e4cdce66 | |
parent | c2b4fccc4dd0a7087e7d0dfd2d6cf9ca31bbb775 (diff) |
Added logic with Firebase and the supplied lib for RTDB
- (Real Time Database)
Changes to be committed:
modified: client_app_flutter/lib/main.dart
modified: client_app_flutter/pubspec.lock
modified: client_app_flutter/pubspec.yaml
-rw-r--r-- | client_app_flutter/lib/main.dart | 8 | ||||
-rw-r--r-- | client_app_flutter/pubspec.lock | 32 | ||||
-rw-r--r-- | client_app_flutter/pubspec.yaml | 1 |
3 files changed, 40 insertions, 1 deletions
diff --git a/client_app_flutter/lib/main.dart b/client_app_flutter/lib/main.dart index e00d0ae..31bc250 100644 --- a/client_app_flutter/lib/main.dart +++ b/client_app_flutter/lib/main.dart @@ -3,9 +3,13 @@ import 'package:flutter/material.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:client_app_flutter/firebase_options.dart'; +import 'package:firebase_database/firebase_database.dart'; + Future <void> main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); + + // FirebaseDatabase database = FirebaseDatabase.instance; runApp(const MyApp()); } @@ -60,6 +64,7 @@ class MyHomePage extends StatefulWidget { } class _MyHomePageState extends State<MyHomePage> { + FirebaseDatabase database = FirebaseDatabase.instance; int _counter = 0; void _incrementCounter() { @@ -69,7 +74,8 @@ class _MyHomePageState extends State<MyHomePage> { // so that the display can reflect the updated values. If we changed // _counter without calling setState(), then the build method would not be // called again, and so nothing would appear to happen. - _counter++; + // _counter++; + _counter = database.hashCode; }); } diff --git a/client_app_flutter/pubspec.lock b/client_app_flutter/pubspec.lock index b796c5a..eb82657 100644 --- a/client_app_flutter/pubspec.lock +++ b/client_app_flutter/pubspec.lock @@ -1,6 +1,14 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + _flutterfire_internals: + dependency: transitive + description: + name: _flutterfire_internals + sha256: "5dadadeecceac19d6a63c9d2e037bb8df58ddd4aedb94e8a056af2f39ee50f9d" + url: "https://pub.dev" + source: hosted + version: "1.3.11" async: dependency: transitive description: @@ -81,6 +89,30 @@ packages: url: "https://pub.dev" source: hosted version: "2.8.1" + firebase_database: + dependency: "direct main" + description: + name: firebase_database + sha256: "69173b20210c67965407f60bf6842af09fc7a43be6cb0e0fa922ea16ea71ee2c" + url: "https://pub.dev" + source: hosted + version: "10.3.3" + firebase_database_platform_interface: + dependency: transitive + description: + name: firebase_database_platform_interface + sha256: "8bf23132981a09798963f2ffab97ccd651c1c45aa4c0891dd2dd9007b390fb7d" + url: "https://pub.dev" + source: hosted + version: "0.2.5+11" + firebase_database_web: + dependency: transitive + description: + name: firebase_database_web + sha256: "6b3c6d4b0194678b857233f04f53c3c90178495091e5cde4ed37f9ca4ca023f2" + url: "https://pub.dev" + source: hosted + version: "0.2.3+11" flutter: dependency: "direct main" description: flutter diff --git a/client_app_flutter/pubspec.yaml b/client_app_flutter/pubspec.yaml index 177ae79..a2dda0a 100644 --- a/client_app_flutter/pubspec.yaml +++ b/client_app_flutter/pubspec.yaml @@ -36,6 +36,7 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 firebase_core: ^2.21.0 + firebase_database: ^10.3.3 dev_dependencies: flutter_test: |