Posts

Showing posts with the label dart

Flutter: Facebook and Google Authentication

I am trying to include Facebook and Google Authentication in my app which I am creating using Flutter. Is there a tutorial where I can utilize to implement as it is bit uncertain on how to include html elements and Javascript in Flutter to enable such authentication. Or is there a complete different way of authentication for Flutter? You can use the google_sign_in plugin. Check out the documentation in the plugins repo and on pub. There isn't a Facebook plugin yet, but you could write one. I'd recommend leveraging Firebase. Here is a codelab: https://codelabs.developers.google.com/codelabs/flutter-firebase/index.html#0 Adding this late answer since now there is a package, flutter_facebook_login that replaces flutter_facebook_connect. Here is a functioning main.dart example that should work. Just keep in mind you must have followed all configuration as described in the repository and must have a facebook app configured: import 'package:flutter/material.dart...

Flutter standard packages

As I see several dart packages published at dart package website, I am curious to know what packages does flutter endorse? The question would be vague, so I would like to focus on a specific package dio. I have contacted few flutter developers, and have been told that the package is not yet a industry standard, also I was introduced to some packages that were published just hours back, for example jaguar_retrofit. I also see dart https package used frequently in flutter documentation. This weighs me to look at what would be the most promising in the future. Can someone solve the package mystery for me, any flutter insights available? This is a valid question, but not one that you'll probably find a final answer to on stackoverflow (and it may be closed as off-topic although I won't cast that vote). You might find better luck at https://softwarerecs.stackexchange.com/ although there may not be too many dart/flutter specific people there; I don't know for sure. But reali...

flutter reference to unspecified seems stuck at 0.3.4

I'm trying to add a reference to openid_client in my flutter app. I add a dependency to openid_client: ^0.1.3 in my pubspec.yaml and save. This runs flutter packages get, which reports the following error: Package unscripted has no versions that match >=0.6.2 <0.7.0 derived from: - openid_client 0.1.0 depends on version >=0.6.2 <0.7.0 Indeed, the openid_client package does depend on unscripted version 0.6.2, but my flutter app cannot reference 0.6.2. It appears the highest version of unscripted my flutter app can reference is 0.3.4. Does anyone know what I'm doing wrong? This is my pubspec.yaml as it currently stands: name: flit description: A new Flutter project. dependencies: flutter: sdk: flutter cupertino_icons: ^0.1.0 english_words: ^3.1.0 openid_client: ^0.1.3 dev_dependencies: flutter_test: sdk: flutter flutter: uses-material-design: true

Google, Facebook Sign in support with Flutter

I am new to Flutter, Is there any way that i can provide Sign in using GOOGLE/FACEBOOK with Flutter. Thanks Adding this late answer since now there is a package, flutter_facebook_login that replaces flutter_facebook_connect. Here is a functioning main.dart example that should work. Just keep in mind you must have followed all configuration as described in the repository and must have a facebook app configured: import 'package:flutter/material.dart'; import 'package:flutter_facebook_login/flutter_facebook_login.dart'; import 'dart:async'; void main() => runApp(new MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( title: 'Flutter Facebook Login', theme: new ThemeData( primarySwatch: Colors.blue, ), home: new MyHomePage(title: 'Flutter Login Facebook'), ); } } class MyHomePage extends StatefulWidget { MyHomePage({Key key, this...

Json Flutter - Error with Json post method in Flutter giving HTML error

i am trying to post to an api by flutter but it give me this error : I/flutter ( 5558): <!DOCTYPE html> I/flutter ( 5558): <html lang="en"> I/flutter ( 5558): <head> I/flutter ( 5558): <meta charset="utf-8"> I/flutter ( 5558): <title>Error</title> I/flutter ( 5558): </head> I/flutter ( 5558): <body> I/flutter ( 5558): <pre>Cannot POST /login</pre> I/flutter ( 5558): </body> I/flutter ( 5558): </html> I/flutter ( 5558): POST http://192.168.1.5:5000/login my code : void create() async { Dio dio = Dio(); var response = await http.post('http://192.168.1.5:5000/login',headers: { "Accept":"application/json", },body: { "username": "${usernameController.text}", "password": "${passwordController.text}" }); print(response.body); print(response.request); } anyone can help plz...

How to modify plugins Dart code Flutter?

I am developing a Flutter app, and it uses map_view plugin. I want to add new functionalities to the plugin by modifying the source code. How do I find the actual source code of the plugin in my project after installing it through Flutter? How plugin is added in Flutter The dependency for map_view plugin is added to pubspec.yaml as below, then running flutter packages get will add it to the project. dev_dependecies: map_view: With the git reposity of the desired plugin here Clone it. Make your modification Submit a pull request. And done We usually use packages by importing them in the files where we need them. To modify a plugin, you need to Ctrl + click on the import line (for e.g. import 'package:dio/dio.dart';) ctrl + clicking on this line will open the source code for this plugin. You can edit the code there. Remember, the change won't be permanent and if you push your code to git and then clone it later, the changes you've done w...

Material flutter app source code

There used to be a sample application, called Material flutter. It was a nice show case of all the flutter widgets. Does anyone knows where the source code is? The source code for the Flutter Gallery demo application is at: https://github.com/flutter/flutter/tree/master/examples/flutter_gallery/ there are some example projects in your flutter install location located in the examples folder.

flutter error when using refactor extract flutter widget option in intellij idea

When I am trying to use 'Refactor - Extract - flutter widget' option in Intellij idea for refactoring a code in a widget, I am getting following error. Server error: Invalid parameter 'params.kind'. Expected to be RefactoringKind; found ""EXTRACT_WIDGET"". There is no solution available on internet for this. Please help Flutter doctor output Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel beta, v0.2.3, on Microsoft Windows [Version 10.0.16299.371], locale en-US) [√] Android toolchain - develop for Android devices (Android SDK 27.0.1) [√] Android Studio (version 3.0) [√] IntelliJ IDEA Community Edition (version 2017.3) [√] VS Code, 64-bit edition (version 1.22.2) [√] Connected devices (1 available) • No issues found!

Flutter typedMiddleware

I am kinda new to flutter and trying out the flutter redux library but I am stuck with having a proper list of middlewares. import 'package:flutter_app/incrementButtonScreen/IncrementButtonActions.dart'; import 'package:flutter_app/incrementButtonScreen/IncrementButtonLogicStates.dart'; import 'package:flutter_app/incrementButtonScreen/IncrementButtonState.dart'; import 'package:redux/redux.dart'; List<Middleware<IncrementButtonState>> createIncrementButtonStoreMiddleware = [ TypedMiddleware<IncrementButtonState, Increment>(createIncrement("typed")), createIncrement("normal") ]; Middleware<IncrementButtonState> createIncrement(String logger) { return (Store store, action, NextDispatcher next) { print('\n ACTION $logger : ${new DateTime.now()}: $action'); // some api call happening here and passing the APi call result next next(IncrementButtonLogicIncrementState(220, 15.0)); }; } the...

google map flutter plugin

hello I try to use google map plugin for flutter https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter I use this exemple https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter/example/lib but in this exemple there is some page. In my application I need only one map at the launch on the app. Problem, with this exemple I didn't manage to use it at my convenience. So I try to use the minimalist example of the read.me but it's a statlesswidget, and I and can't integer Tag fonction or the map_ui.dart like the complet example. So I tried to pass this stateless in statefull but when I do this I have an error here is what I tried to compile from the two example exemple 1 https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter void main() { GoogleMapController.init(); final GoogleMapOverlayController controller = GoogleMapOverlayController.fromSize(width: 300.0, height: 200.0); final Widget mapWidget = GoogleMap...

flutter websocket connection issue

I am trying to develop a flutter app which connects to the server and exchanges data using websocket. The server is in .Net Core and using Asp.Net Core Websockets to implement this functionality. The problem I am facing is, my flutter app is not able to connect to the server and throws following error. E/flutter (31498): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception: E/flutter (31498): WebSocketChannelException: WebSocketChannelException: WebSocketException: Connection to 'http://127.0.0.1/client#' was not upgraded to websocket E/flutter (31498): #0 new IOWebSocketChannel._withoutSocket.<anonymous closure> (package:web_socket_channel/io.dart:83:24) E/flutter (31498): #1 _invokeErrorHandler (dart:async/async_error.dart:13:29) E/flutter (31498): #2 _HandleErrorStream._handleError (dart:async/stream_pipe.dart:286:9) E/flutter (31498): #3 _ForwardingStreamSubscription._handleError (dart:async/stream_pipe.dart:168:13) E/flutter (3149...

Dart & Flutter Development

Is Dart my only programming language option with Flutter or can I use other languages like C++, Java, Kotlin, or Go? What are all the available options for langugaes with the Flutter framework if they're are additional options. Dart is the only programming language that is currently supported by the Flutter framework. You can get started here. To be honest, I doubt that there are any plans on integrating other programming languages because Flutter is built around Dart and vise versa. When writing applications in the framework, you can still access native code, that would be Android (Java, Kotlin, C++), iOS (Objective-C, Swift) and probably other platforms in the future.

Flutter - Loops for ListTile

I am not sure how to generate multiple ListTiles by means of loops, such as for(). I do not know how Flutter works for rendering widgets, since in Angular 2 just insert the *ngFor directives in the layout (html). I could not find such a subject in the Flutter documentation. main.dart import 'package:flutter/material.dart'; void main() { runApp(new MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( title: "Myapp", home: new HomePage(), ); } } class HomePage extends StatelessWidget { @override Widget build(BuildContext context) => new Scaffold( appBar: new AppBar( backgroundColor: new Color(0xFF26C6DA), ), body: new ListView ( children: <Widget>[ new Card( child: new Column( mainAxisSize: MainAxisSize.min, children: <Widget>[ const ListTile( leading: const Icon...

Flutter App lifecycle (Android/ Ios )

Is any Activity life cycle method in flutter app android ? Like: onCreate() onResume() onDestroy() Or: viewDidload() viewWillAppear() How to handle application life cycle when make an app with flutter? There is a method called when the system put the app in the background or return the app to foreground named didChangeAppLifecycleState. Example with widgets: class _AppLifecycleReactorState extends State<AppLifecycleReactor> with WidgetsBindingObserver { @override void initState() { super.initState(); WidgetsBinding.instance.addObserver(this); } @override void dispose() { WidgetsBinding.instance.removeObserver(this); super.dispose(); } AppLifecycleState _notification; @override void didChangeAppLifecycleState(AppLifecycleState state) { setState(() { _notification = state; }); } @override Widget build(BuildContext context) { return new Text('Last notification: $_notification'); } } Also there are CONSTANTS to know the...

Crash Report for Flutter

I am new to flutter. I developed one Wallpaper App using flutter and upload in playstore. Now i need to track crash report for that app. In Android have crashlytics to all report crash and more fearure's. Is crashlytics support in flutter ?. I looked sentry plugin but it's not free. Any help Appreciable. Sentry is currently the only solution provided by the Flutter team. Crashlytics support is planned https://github.com/flutter/flutter/issues/14765 update There is now a community package with crashlytics support as well https://pub.dartlang.org/packages/flutter_crashlytics

map_view => NoSuchMethodError flutter

After update flutter I have this error bellow, only when I erase app and release a new app. If I just hot reload I havn't this error and map is launch correctly. I'm certain it's was after update flutter. I saved each blocs validations, and now this issue is repeatable with all previous backup, and I certain that I validate this fonction after remove and reinstall app in libobject_patch.dart @patch dynamic noSuchMethod(Invocation invocation) { // TODO(regis): Remove temp constructor identifier 'withInvocation'. throw new NoSuchMethodError.withInvocation(this, invocation); } in the console E/flutter (28250): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception: E/flutter (28250): NoSuchMethodError: The method 'substring' was called on null. E/flutter (28250): Receiver: null E/flutter (28250): Tried calling: substring(1, 10) E/flutter (28250): #0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:46:5) E/flutter (28250): #1...

Android's Wallpapermanager in Flutter?

I am writing an app for Android in Flutter that sets the user's wallpaper. I am having trouble finding how to do this, as Flutter is made to compile to both iOS and Android apps, and iOS doesn't allow apps to set a wallpaper. In Android, one can use the WallpaperManager. Is there some way I can call this in Flutter, or is there some equivalent? I don't mind losing iOS compatibility, I just want it to work on Android. Yes, flutter has platform-channel which allows you to call native code via flutter. You can take a look at this flutter example that shows how to implement a platform channel in flutter. Hope that helps!

Flutter - RangeError(index)

I get an error while I'm building a ListView. In this flutter app I try to count for each column some points when a button is clicked. But I'm getting always the same error. ══╡ EXCEPTION CAUGHT BY GESTURE I/flutter (28729): The following RangeError was thrown while handling a gesture: I/flutter (28729): RangeError (index): Invalid value: Valid value range is empty: 0 This is my code and I hope somebody is able to help me fixing the error: import 'package:flutter/material.dart'; class Punktezaehler extends StatefulWidget{ final List<String> spieler_namen; Punktezaehler(this.spieler_namen); @override State<StatefulWidget> createState() => new _Punktezaehler(this.spieler_namen); } class _Punktezaehler extends State<Punktezaehler>{ final List<String> spieler_namen; _Punktezaehler(this.spieler_namen); List<int> punkteanzahl_teamEins = []; List<int> punkteanzahl_teamZwei = []; int team1_hinzugezaehlt = 0; i...

Dismissing AlertDialog in Flutter

I have simple Flutter app with list of items that are loaded from Firebase database (Cloud Firestore). As you can see - there is button for adding items and each item can be deleted or edited. When I press edit button for selected item, AlertDialog with TextField appears, in this TextField user can see current item name and edit it. I have problems only with dismissing dialog after editing. new IconButton( icon: new Icon(Icons.edit, color: Colors.white), onPressed: (){ showItemUpdateDialog(context, document); } ) ....... void showItemUpdateDialog(BuildContext context, DocumentSnapshot item) { String itemName = ""; var textContoller = new TextEditingController(); textContoller.text = item['name']; var dialog = new AlertDialog( title: new Text("item name"), content: new TextField( controller: textContoller, onChanged: (value) {newName = value;}, ), actions: <Widget>[ new FlatButton( ...

Flutter firebase handling exceptions

I am trying to catch the exceptions thrown by Firebase (from failed login) to flutter but I am having zero luck. .catcherror seems to print out the error but an exception is still crashing my code. I have found similar issues in other posts but no answers seem to help me, it's making my code unusable, thank you so much. try { signIn(typedemail, typedpassword).catchError((e) { print(e); print(e.message.toString()+"rrrrr"); print(e.code); print(e.details); }); } on PlatformException catch (e) { print("on worked");//this doesnt work } finally{ print("finally"); } And I get this if I disable breaking on exceptions D/FirebaseApp(11795): Notified 0 auth state listeners. I/flutter (11795): PlatformException(exception, The email address is badly formatted., null) I/flutter (11795): The email address is badly formatted.rrrrr I/flutter (11795): exception I/flutter (11795): null