Baseflow / screenrecorder

Flutter package which can be used to record flutter widgets
https://pub.dev/packages/screen_recorder
MIT License
64 stars 27 forks source link

three errors . #2

Closed ghost closed 3 years ago

ghost commented 3 years ago

I am new to flutter.

I want to make a screen recorder app .

I used this plugin and your example code but I have 3 errors.

  D:\screenrecorder>flutter run
  Launching lib\main.dart on SM M307F in debug mode...
  lib/main.dart:22:19: Error: The parameter 'key' can't have a value of 'null' because of its type 'Key', but the implicit default value is 
  'null'.
 - 'Key' is from 'package:flutter/src/foundation/key.dart' ('/C:/flutter/packages/flutter/lib/src/foundation/key.dart').
 Try adding either an explicit non-'null' default value or the 'required' modifier.
 MyHomePage({Key key, this.title}) : super(key: key);
              ^^^
lib/main.dart:22:29: Error: The parameter 'title' can't have a value of 'null' because of its type 'String', but the implicit default value 
  is 'null'.
  Try adding either an explicit non-'null' default value or the 'required' modifier.
  MyHomePage({Key key, this.title}) : super(key: key);
                        ^^^^^
 lib/main.dart:83:45: Error: The argument type 'List<int>?' can't be assigned to the parameter type 'Uint8List'.
 - 'List' is from 'dart:core'.
 - 'Uint8List' is from 'dart:typed_data'.
                  content: Image.memory(gif),
                                        ^

FAILURE: Build failed with an exception.

* Where:
 Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1035

 * What went wrong:
 Execution failed for task ':app:compileFlutterBuildDebug'.
 > Process 'command 'C:\flutter\bin\flutter.bat'' finished with non-zero exit value 1

 * 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 17s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                        81.3s
Exception: Gradle task assembleDebug failed with exit code 1

Error at this two lines

  1. https://github.com/ueman/screenrecorder/blob/main/example/lib/main.dart#L22
  2. https://github.com/ueman/screenrecorder/blob/main/example/lib/main.dart#L83

1 2

How can I solve this ?

ueman commented 3 years ago

The example does not use nullsafety yet. You'll either need to migrate it to nullsafety or disable nullsafety.

Please note that bugs and errors are expected at its current state.

It should definitely not be used in a production app at this point.

ghost commented 3 years ago

I solved the first two errors.

How can I solve this error ?

content: Image.memory(gif)

error at this line : https://github.com/ueman/screenrecorder/blob/main/example/lib/main.dart#L83

2

ueman commented 3 years ago

You'll need a null check for gif

ghost commented 3 years ago

I can't understand. Can your explain in detail ? Or give some codes.

ueman commented 3 years ago

No, unfortunately not. This software is in alpha state and bugs/errors are expected.

Please reach out to https://flutter.dev/community for help.

calcitem commented 3 years ago

I can't understand. Can your explain in detail ? Or give some codes.

AlertDialog(content: Image.memory(Uint8List.fromList(gif)));