diff options
-rw-r--r-- | flutter_01.log | 123 | ||||
-rw-r--r-- | lib/globals.dart | 38 | ||||
-rw-r--r-- | lib/main.dart | 2 | ||||
-rw-r--r-- | pubspec.yaml | 1 |
4 files changed, 16 insertions, 148 deletions
diff --git a/flutter_01.log b/flutter_01.log deleted file mode 100644 index aad75d0..0000000 --- a/flutter_01.log +++ /dev/null @@ -1,123 +0,0 @@ -Flutter crash report; please file at https://github.com/flutter/flutter/issues. - -## command - -flutter packages get - -## exception - -YamlException: Error on line 9, column 3: Expected ':'. - flutter: - ^ - -``` -#0 Scanner._staleSimpleKeys (package:yaml/src/scanner.dart:491) -#1 Scanner._fetchMoreTokens (package:yaml/src/scanner.dart:325) -#2 Scanner.peek (package:yaml/src/scanner.dart:317) -#3 Parser._parseBlockMappingKey (package:yaml/src/parser.dart:418) -#4 Parser._stateMachine (package:yaml/src/parser.dart:86) -#5 Parser.parse (package:yaml/src/parser.dart:47) -#6 Loader._loadMapping (package:yaml/src/loader.dart:171) -#7 Loader._loadNode (package:yaml/src/loader.dart:86) -#8 Loader._loadMapping (package:yaml/src/loader.dart:165) -#9 Loader._loadNode (package:yaml/src/loader.dart:86) -#10 Loader._loadDocument (package:yaml/src/loader.dart:62) -#11 Loader.load (package:yaml/src/loader.dart:54) -#12 loadYamlDocument (package:yaml/yaml.dart:51) -#13 loadYamlNode (package:yaml/yaml.dart:42) -#14 loadYaml (package:yaml/yaml.dart:34) -#15 _pluginFromPubspec (package:flutter_tools/src/plugins.dart:52) -#16 _findPlugins.<anonymous closure> (package:flutter_tools/src/plugins.dart:75) -#17 _HashVMBase&MapMixin&&_LinkedHashMapMixin.forEach (dart:collection-patch/dart:collection/compact_hash.dart:363) -#18 _findPlugins (package:flutter_tools/src/plugins.dart:73) -#19 injectPlugins (package:flutter_tools/src/plugins.dart:234) -#20 FlutterProject.ensureReadyForPlatformSpecificTooling (package:flutter_tools/src/project.dart:62) -#21 PackagesGetCommand.runCommand (package:flutter_tools/src/commands/packages.dart:85) -<asynchronous suspension> -#22 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:344) -<asynchronous suspension> -#23 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:279) -<asynchronous suspension> -#24 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:142) -<asynchronous suspension> -#25 _rootRun (dart:async/zone.dart:1126) -#26 _CustomZone.run (dart:async/zone.dart:1023) -#27 runZoned (dart:async/zone.dart:1501) -#28 AppContext.run (package:flutter_tools/src/base/context.dart:141) -<asynchronous suspension> -#29 FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:270) -#30 CommandRunner.runCommand (package:args/command_runner.dart:194) -<asynchronous suspension> -#31 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:309) -<asynchronous suspension> -#32 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:142) -<asynchronous suspension> -#33 _rootRun (dart:async/zone.dart:1126) -#34 _CustomZone.run (dart:async/zone.dart:1023) -#35 runZoned (dart:async/zone.dart:1501) -#36 AppContext.run (package:flutter_tools/src/base/context.dart:141) -<asynchronous suspension> -#37 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:265) -<asynchronous suspension> -#38 CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:109) -#39 new Future.sync (dart:async/future.dart:222) -#40 CommandRunner.run (package:args/command_runner.dart:109) -#41 FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:174) -#42 run.<anonymous closure> (package:flutter_tools/runner.dart:59) -<asynchronous suspension> -#43 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:142) -<asynchronous suspension> -#44 _rootRun (dart:async/zone.dart:1126) -#45 _CustomZone.run (dart:async/zone.dart:1023) -#46 runZoned (dart:async/zone.dart:1501) -#47 AppContext.run (package:flutter_tools/src/base/context.dart:141) -<asynchronous suspension> -#48 runInContext (package:flutter_tools/src/context_runner.dart:43) -<asynchronous suspension> -#49 run (package:flutter_tools/runner.dart:50) -#50 main (package:flutter_tools/executable.dart:49) -<asynchronous suspension> -#51 main (file:///b/build/slave/Linux_Flutter_Packaging/build/archive/flutter/packages/flutter_tools/bin/flutter_tools.dart:8) -#52 _startIsolate.<anonymous closure> (dart:isolate-patch/dart:isolate/isolate_patch.dart:277) -#53 _RawReceivePortImpl._handleMessage (dart:isolate-patch/dart:isolate/isolate_patch.dart:165) -``` - -## flutter doctor - -``` -[✓] Flutter (Channel beta, v0.5.1, on Linux, locale en_US.UTF-8) - • Flutter version 0.5.1 at /opt/flutter - • Framework revision c7ea3ca377 (8 weeks ago), 2018-05-29 21:07:33 +0200 - • Engine revision 1ed25ca7b7 - • Dart version 2.0.0-dev.58.0.flutter-f981f09760 - -[!] Android toolchain - develop for Android devices (Android SDK 26.0.2) - • Android SDK at /opt/android-sdk/ - • Android NDK location not configured (optional; useful for native profiling support) - • Platform android-28, build-tools 26.0.2 - • ANDROID_HOME = /opt/android-sdk - • Java binary at: /usr/bin/java - • Java version OpenJDK Runtime Environment (build 1.8.0_172-b11) - ✗ Android license status unknown. - -[✗] Android Studio (not installed) - • Android Studio not found; download from https://developer.android.com/studio/index.html - (or visit https://flutter.io/setup/#android-setup for detailed instructions). - -[!] IntelliJ IDEA Ultimate Edition (version 2018.1) - • IntelliJ at /opt/intellij-idea-ultimate-edition - ✗ Flutter plugin not installed; this adds Flutter specific functionality. - ✗ Dart plugin not installed; this adds Dart specific functionality. - • For information about installing plugins, see - https://flutter.io/intellij-setup/#installing-the-plugins - -[!] VS Code (version 1.24.1) - • VS Code at /usr/share/code - • Flutter extension not installed; install from - https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter - -[✓] Connected devices (1 available) - • ONE E1003 • 2bb416ea • android-arm • Android 8.1.0 (API 27) - -! Doctor found issues in 4 categories. -``` diff --git a/lib/globals.dart b/lib/globals.dart index 7195798..818183c 100644 --- a/lib/globals.dart +++ b/lib/globals.dart @@ -4,6 +4,7 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; import 'package:flutter/material.dart'; +import 'package:http/http.dart' as http; //Variables bool isLoggedIn = false; @@ -15,7 +16,7 @@ String error = ""; String id = "0"; String firstname = ""; String email = ""; -String avatar ="https://api.adorable.io/avatars/128/BEAM-Messenger.png"; +String avatar = "https://api.adorable.io/avatars/128/BEAM-Messenger.png"; class Utility { static Future<Null> showAlertPopup( @@ -44,37 +45,26 @@ class Utility { ); } - static Future<String> getData(String params) async { + static Future<String> getData(Map params) async { var requestURL = apiURL; - requestURL = requestURL + params; -// requestURL = requestURL + "calltype=" + calltypeParm; -// requestURL = requestURL + "&mod=" + modParm; -// requestURL = requestURL + "&?action=" + actionParm; -// requestURL = requestURL + "&?param=" + paramsParm; -// requestURL = requestURL + "&?foo=" + fooParm; + requestURL = requestURL; print("Request URL: " + requestURL); var url = requestURL; - var httpClient = new HttpClient(); String result; + try { - var request = await httpClient.getUrl(Uri.parse(url)); - var response = await request.close(); - if (response.statusCode == HttpStatus.OK) { - try { - var json = await response.transform(UTF8.decoder).join(); - result = json; - } catch (exception) { - result = 'Error Getting Data'; - } - } else { - result = - 'Error getting IP address:\nHttp status ${response.statusCode}'; - } + await http.post(url, body: { + "email": params["email"], + "password": params["password"] + }).then((response) { + result = response.body; + print('Answer: ' + result.toString()); + }); } catch (exception) { - result = 'Failed getting IP address'; + result = 'Failed logging in'; } - print("Result: " + result); + return result; } diff --git a/lib/main.dart b/lib/main.dart index e547f62..e56c38d 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -74,7 +74,7 @@ class LoginPageState extends State<LoginPage> { Future<bool> _loginRequest(String email, String password) async { String result = ""; - result = await globals.Utility.getData(""); + result = await globals.Utility.getData({'email': email, 'password': password}); //Decode Data try { diff --git a/pubspec.yaml b/pubspec.yaml index 448b450..3cb6e02 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,6 +5,7 @@ dependencies: local_auth: "^0.2.0" shared_preferences: "^0.4.0" cupertino_icons: any + http: any flutter: sdk: flutter |