Giter Site home page Giter Site logo

flutter-cookbook's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter-cookbook's Issues

Future<dynamic> can't be returned

Hi I'm doing the excercise on chapter 7 (Unfortunately my ebook doesn't show the page no) and I get the following error in main.dart file on line 41: return completer.future (underlined red):

A value of type 'Future<dynamic>' can't be returned from the method 'getNumber' because it has a return type of 'Future<int>'.

How to turn the completer into type future?

Using Firebase, Storing files in the cloud: Missed Step

The recipe that shows how to upload the local file to the Cloud Storage clearly misses the step in which the Cloud Storage has to be "configured first", otherwise the Firebase will report the 404 error and a cryptic message ("File Not Found").
As someone who didn't work with the Firebase cloud storage before, it took me several attempts to figure out what needs to be done and for a beginner this may end up in a complete confusion.

No geolocator permissions hint

I had to look up answer myself. Added these lines to android/app/src/debug/AndroidManifest.xml:

    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

type 'Null' is not a subtype of type 'String'

i'm using a new version of flutter
i get this error: type 'Null' is not a subtype of type 'String'

at the 3rd this line of the code (plan_services.dart):

  Plan createPlan(String name) {
    final model = _repository.create();
    print('my name $name');                                           //the name in not null here
    final plan = Plan.fromModel(model)..name = name;            //error here
    savePlan(plan);
    return plan;
  }

after debugging, i got name=null here (plan.dart)

  Plan.fromModel(Model model)
      : id = model.id,
        name = model.data['name'],             //the name is null here
        tasks = model.data['task']
                ?.map<Task>((task) => Task.fromModel(task))
                ?.toList() ??
            <Task>[];

can you explain why? thank you

Chapters 4 and 5

Those chapters do not work due to null safety in Flutter 2.5 - it would be great if those could be updated

Update code for null-safety

Sound null safety is available in Dart 2.12 and Flutter 2.

This issue could be a big problem for a beginner using the latest version of Dart.

related to null safety?

For the pizza json chapter 8 I believe with a factory constructor, null cannot be returned. Please update the code. I have no idea what purpose the factory serves now except if there is a cache of instantiated pizzas in the pizza class which then could be used to optimize a bit by not having to instantiate every instance. But I am unclear on the "how" this works under the hood.

Mastering layout Dog/Beach is wrong

If you debug in Chrome and stretch the window's width, the heading: value text is left at the left edge while everything else centers. The stack should only include the background and photo and then be encapsulated by a Column so you can put the other text under the Stack in the column, all as children of the Column. Thus if you probably rotate screen to Landscape on a device the same thing happens. It's a shame because it's a good book but you did not test out your code a bit more to make it robust for various use cases. As of now it only looks nice when you have a device in Portrait mode or Chrome window at its narrowest width possible.

Compile error on "Using the device camera (p.510)"

Hi!

I am trying to get the device camera example from the cookbook running but get the following compile error. I used the main.dart, camera.dart, picture.dart and pubspec.yaml file provided here without changing anything.

This is the error stack I am getting:

Running "flutter pub get" in camera_app...
The plugin firebase_mlkit_language uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.
Launching lib/main.dart on HUAWEI TAG L21 in debug mode...
Running Gradle task 'assembleDebug'...
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
/Users/stefvenmans/Development/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.7.0+4/android/src/main/java/io/flutter/plugins/camera/CameraUtils.java:138: warning: [deprecation] get(int,int) in CamcorderProfile has been deprecated
return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_HIGH);
^
/Users/stefvenmans/Development/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.7.0+4/android/src/main/java/io/flutter/plugins/camera/CameraUtils.java:142: warning: [deprecation] get(int,int) in CamcorderProfile has been deprecated
return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_2160P);
^
/Users/stefvenmans/Development/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.7.0+4/android/src/main/java/io/flutter/plugins/camera/CameraUtils.java:146: warning: [deprecation] get(int,int) in CamcorderProfile has been deprecated
return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_1080P);
^
/Users/stefvenmans/Development/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.7.0+4/android/src/main/java/io/flutter/plugins/camera/CameraUtils.java:150: warning: [deprecation] get(int,int) in CamcorderProfile has been deprecated
return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_720P);
^
/Users/stefvenmans/Development/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.7.0+4/android/src/main/java/io/flutter/plugins/camera/CameraUtils.java:154: warning: [deprecation] get(int,int) in CamcorderProfile has been deprecated
return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_480P);
^
/Users/stefvenmans/Development/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.7.0+4/android/src/main/java/io/flutter/plugins/camera/CameraUtils.java:158: warning: [deprecation] get(int,int) in CamcorderProfile has been deprecated
return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_QVGA);
^
/Users/stefvenmans/Development/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.7.0+4/android/src/main/java/io/flutter/plugins/camera/CameraUtils.java:162: warning: [deprecation] get(int,int) in CamcorderProfile has been deprecated
return CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_LOW);
^
error: warnings found and -Werror specified
/Users/stefvenmans/Development/flutter/.pub-cache/hosted/pub.dartlang.org/camera-0.7.0+4/android/src/main/java/io/flutter/plugins/camera/media/MediaRecorderBuilder.java:15: warning: [deprecation] MediaRecorder() in MediaRecorder has been deprecated
return new MediaRecorder();
^
1 error
8 warnings

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':camera:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 1m 31s
*********************************************************
WARNING: This version of firebase_mlkit_language will break your Android build if it or its dependencies aren't compatible with AndroidX.
See https://goo.gl/CP92wY for more information on the problem and how to fix it.
This warning prints for all Android build failures. The real root cause of the error may be unrelated.
*********************************************************
Exception: Gradle task assembleDebug failed with exit code 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.