apress / practical-flutter Goto Github PK
View Code? Open in Web Editor NEWSource Code for 'Practical Flutter' by Frank Zammetti
Home Page: https://www.apress.com/9781484249710
License: Other
Source Code for 'Practical Flutter' by Frank Zammetti
Home Page: https://www.apress.com/9781484249710
License: Other
Bom dia !!!
Tive que ajustar o arquivo pubspec.yaml nas dependências para :
flutter_slidable: 0.5.4
Está dando erro Appointments.dart nas linhas :
return Slidable(
actionPane: SlidableDrawerActionPane(),
image_picker: 0.6.3+4
Neste caso estava dando erro na compilação.
I add the following example from the book. This is a working flutter_chat code.
Flutter chat - https://github.com/DenisNaN/Flutterchat
Flutter chat server node.js - https://github.com/DenisNaN/Flutterchat_server
Just started my journey in mobile development. I really like the book, but the code in it does not work because of null safety. Therefore, I corrected the code due to my abilities. Don't scold too much. But for those who are starting to learn Flutter, it's better to face what works.
New to dart/flutter, so learning to debug with Android Studio. Interesting, but a bit confusing.
Using the git code, I have this error:
I/flutter (21442): ## AppointmentsEntry.build()
I/flutter (21442): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (21442): The following NoSuchMethodError was thrown building AppointmentsEntry(dirty):
I/flutter (21442): The getter 'title' was called on null.
I/flutter (21442): Receiver: null
I/flutter (21442): Tried calling: title
I/flutter (21442):
I/flutter (21442): User-created ancestor of the error-causing widget was:
I/flutter (21442): IndexedStack file:///D:/FlutterProjects/flutter_book/lib/ap
pointments/Appointments.dart:38:18
I/flutter (21442):
I/flutter (21442): When the exception was thrown, this was the stack:
I/flutter (21442): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
I/flutter (21442): #1 AppointmentsEntry.build (package:flutter_book/appointments/AppointmentsEntry.dart:49:72)
I/flutter (21442): #2 StatelessElement.build (package:flutter/src/widgets/framework.dart:4026:28)
... etc...
I tried just plugging a hard coded value to the text element, but to no avail.
This section of AppointmentsEntry...
print("## AppointmentsEntry.build()");
// Set value of controllers.
_titleEditingController.text = appointmentsModel.entityBeingEdited.title;
_descriptionEditingController.text = appointmentsModel.entityBeingEdited.description;
... seems to be where the title element of appointmentsModel.entityBeingEdited is assigned. According to the next "up" stack entry, Object.noSuchMethod implies this data element is a method, or the idea of an "=" assignment is in valid. Counterintuitive, at best.
What am I missing here? I keep looking at the class definitions, but nothing bad jumps out at me.
Does this code for for others?
I add the following example from the book. This is a working flutter_hero code.
Flutter hero - https://github.com/DenisNaN/Flutterhero
I was constantly stuck on a white screen when trying to run the app, turns out the main method was missing the following line:
WidgetsFlutterBinding.ensureInitialized();
The error was due to mixing await and runApp() inside main().
Similar problem on Stackoverflow that fixed it for me:
(https://stackoverflow.com/questions/57689492/flutter-unhandled-exception-servicesbinding-defaultbinarymessenger-was-accesse
Using Android Studio to build the flutter_book project. Getting
Resolving dependencies...
Running Gradle task 'assembleDebug'...
C:\Users\roger\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerDelegate.java:15: error: package android.support.annotation does not exist
import android.support.annotation.VisibleForTesting;
^
C:\Users\roger\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerDelegate.java:16: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
^
symbol: class ActivityCompat
location: package android.support.v4.app
C:\Users\roger\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerDelegate.java:17: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;
^
C:\Users\roger\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerFileProvider.java:3: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;
^
C:\Users\roger\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\image_picker-0.4.12+1\android\src\main\java\io\flutter\plugins\imagepicker\ImagePickerFileProvider.java:10: error: cannot find symbol
public class ImagePickerFileProvider extends FileProvider {}
^
symbol: class FileProvider
... and other errors. I suspect this has to do with an upgrade to flutter, dart, Android Studio or some such since the book version.
Any suggestions? Still rather new to flutter/dart.
I am using flutter v1.9.1+hotfix.5. Running the flutter chat application results in crashes on both iOS and Android. See the corresponding issues on the flutter_socket_io project:
WinkMeter/flutter_socket_io#17
WinkMeter/flutter_socket_io#18
After the upgrade of Flutter to v1.9 I suddenly got this exception thrown that I didn't see before in your code that I didn't modify btw. Using Android Studio under Windows 10.
The following NoSuchMethodError was thrown building AppointmentsEntry(dirty):
The getter 'title' was called on null.
Receiver: null
Tried calling: title
User-created ancestor of the error-causing widget was:
IndexedStack file:///C:/Development/myFlutterProjects/flutter_book/lib/appointments/Appointments.dart:38:22
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.