Giter VIP home page Giter VIP logo

flutter_packages's People

Contributors

ardera avatar

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

Watchers

 avatar  avatar  avatar  avatar

flutter_packages's Issues

[linux_serial] Error when opening serial port

When i open serial port, i get the following error.

flutter: NoSuchMethodError: Class 'Array' has no instance method '[]='.
Receiver: Instance of 'Array'
Tried calling: []=(6, 1)

Code:
final ports = SerialPorts.ports;
final port = ports.singleWhere((p) => p.name.contains('ttyUSB'));
final handle = port.open(baudrate: Baudrate.b19200);

The exception occures when open function called.

Trouble opening serial port

I have an issue opening a serial port using this package.

I have tried in PiOS Lite and a custom Yocto build with same results.

I am running this piece of code

    final ports = SerialPorts.ports;
    print(ports);

    /// find the serial port with the name `ttyS0`
    final port = ports.singleWhere((p) => p.name == 'ttyS0');

    print("port $port");

    /// open the port, so we can read and write things to it
    try {
      _handle = port.open(baudrate: Baudrate.b38400);
    } catch (e) {
      print("SERIAL Exception $e");
    }

Which logs

flutter: {SerialPort(file: File: '/dev/ttyAMA1', name: ttyAMA1), SerialPort(file: File: '/dev/ttyS0', name: ttyS0), SerialPort(file: File: '/dev/ttyAMA0', name: ttyAMA0)}
flutter: port SerialPort(file: File: '/dev/ttyS0', name: ttyS0)

After which the application hangs, without any further errors.
So it seems the open() call causes this.

Any ideas?

[proposal] consider using melos

hi, I noticed that you choose the mono-repo approach
I just wanted to say that relatively recently I've adopted melos
and seems to help to keeps things tidy
(I'm not associated with melos devs or invertase in any way)

if you want to give it a shot feel free to copy-paste from my set up
go ahead and close the issue once you read it

audioplayers example help

Please tell me when to expect an example with audioplayers for flutterpi. Is it possible for this package or any similar package (for example dart_vlc or media_kit) to work on rpi3b+ (raspberrypi os last version) via 3.5mm jack?

Exception error PlatformException(illegalargument, Expected `arg['playerId']` to be a valid player id., null, null)

Hey, trying to get this working on a RP4 using your omxplayer_video_player code and the sample app. I first made sure I followed the instructions here: https://github.com/ardera/flutter-pi and got that fully working. I then modified the flutter_gallery project to load a video player so I can test performance. I first used the normal video_player package and tested that, nothing played but also no errors. I then installed your package and now I get errors in the output. GUI wisd everything loads, white area where player should be, I hit play and nothing. I exit the app and check console and see the errors.

I'm on a RP 4b using bullseye.

video_player 2.2.16 and I also tried 2.0.0

I included a photo below of the output, I also tried to OCR the image for you to get the output in text form.

U: PortSettingsChanged: 1280x720029,97 Interlace:0 deinterlace:0 anaglyph:© par:nan display:© layer:-128 alpha:255 aspecthode:0
[compositor] GPU does not supported the desired Hi plane order.
Sone UI layers may be invisible.
(flutter-pI1 Error handing platform message. plugin_registry_on_platform nessage: Invalid argument
(flutter-pli Error handling platform nessave. plugin registry on _platforn nessage: Invalld argument
[BRRO:Plutter/11b/u1/u1_dart_state.cc(209)]Unhandled Exception? PletfornException (illegalargunent, Expected 'argl'playerld'J° to be a valid player id., null, null?
80
StandardMethodCodee.decodeknuelope(package:flutter/src/services/message_codecs.dart.:607:7)
81
MethodChannel._InvokeMethod (package: flutter/src/serulces/platform_channel.dart:167:18)
asynchronous suspension>
$2
VldeoPlayerController._applyLooping(package:video_player/uldeo_player.dart:465:5)
asynchronous suspension›
null.
null)
MethodChannel.-_Invoketlethod(packagetflutter/sre/serulces/platforn_channel.dart:167:18)
asynchronous suspension›
182
VideoPlayerController._applyVolume(package:uldeo_player/uldeo_player.dart:505:5)
asynchronous suspension›
asynchronous suspension›
3 82
VldeoPlayerController._applyPlayPause(package:vldeo_player/uldeo_player.dart:497:7)
asynchronous suspension>
1 [flutter-pi1 Error handling platform message. pluginregistry_on_platfornnessage: Invalid argunent
MethodChanne1 ._invokeMethod (package: flutter/src/services/platform_channel .dart: 167:16)
asynchronous suspension>
$2
_OmxPlayerVleuController._initialize (package:onxplayer_uldeo_player/src/onxplayer_view.dart:51:5)
‹asynchronous suspension›
R Seek to: 00:00:00
[flutter-pil Error handling platform nessage, plugin registry on platforn_message: Invalld argument
(ERROR: flutter/11b/ul/ul_dart_state.cc(209)] Unhandled Exception: PlatfornException(Illegalargument. Expected 'argi'playerid°J° to be a valid player 1d.. mull.
80
StandardMethodCodec.decodeEnvelope(package:flutter/src/seruices/message_codecs.dart:607:7)
$1
MethodChannel._InvokeMethod(package:flutter/src/serulces/platform_channel.dart:167:18)
(asynchronous suspension>
82
VldeoPlayerController._opplyPlayPause(package:video_player/video_player.dart:473:7)
asynchronous suspension›
$3
VideoPlayerController.play(package:uldeo_player/uldeo_player.dart:445:5)
(asynchronous suspension>

image

Here is the modified main.dart file from the flutter_gallery project (same commit as your readme)

// Copyright 2019 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart' show timeDilation;
import 'package:flutter_gen/gen_l10n/gallery_localizations.dart';
import 'package:flutter_localized_locales/flutter_localized_locales.dart';
import 'package:gallery/constants.dart';
import 'package:gallery/data/gallery_options.dart';
import 'package:gallery/pages/backdrop.dart';
import 'package:gallery/pages/splash.dart';
import 'package:gallery/routes.dart';
import 'package:gallery/themes/gallery_theme_data.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:omxplayer_video_player/omxplayer_video_player.dart';
import 'package:video_player/video_player.dart';
export 'package:gallery/data/demos.dart' show pumpDeferredLibraries;

void main() {
  GoogleFonts.config.allowRuntimeFetching = false;
  if (OmxplayerVideoPlayer.isPlatformSidePresent()) {
    OmxplayerVideoPlayer.useAsImplementation();
  }
  runApp(const VideoApp());
}

class VideoApp extends StatefulWidget {
  @override
  _VideoAppState createState() => _VideoAppState();
  const VideoApp({Key key}) : super(key: key);
}

class _VideoAppState extends State<VideoApp> {
  VideoPlayerController _controller;
  Future<void> _initializeVideoPlayerFuture;

  @override
  void initState() {
    super.initState();
    // _controller = VideoPlayerController.network('https://flutter.github.io/assets-for-api-docs/assets/videos/butterfly.mp4');
    _controller = VideoPlayerController.asset('assets/test.mp4');

    // _controller.addListener(() {
    //   setState(() {});
    // });
    // _controller.setLooping(true);
    _initializeVideoPlayerFuture = _controller.initialize();
    // _controller.play();

    // super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Video Demo',
      home: Scaffold(
        // body: Center(
        //   // child: _controller.value.isInitialized
        //   //     ? AspectRatio(
        //   //         aspectRatio: _controller.value.aspectRatio,
        //   //         child: VideoPlayer(_controller),
        //   //       )
        //   //     : Container(),
        //   child: AspectRatio(
        //     aspectRatio: _controller.value.aspectRatio,
        //     child: Stack(
        //       alignment: Alignment.bottomCenter,
        //       children: <Widget>[
        //         VideoPlayer(_controller),
        //         VideoProgressIndicator(_controller, allowScrubbing: true),
        //       ],
        //     ),
        //   ),
        // ),
        // Use a FutureBuilder to display a loading spinner while waiting for the
        // VideoPlayerController to finish initializing.
        body: FutureBuilder(
          future: _initializeVideoPlayerFuture,
          builder: (context, snapshot) {
            if (snapshot.connectionState == ConnectionState.done) {
              // If the VideoPlayerController has finished initialization, use
              // the data it provides to limit the aspect ratio of the video.
              return AspectRatio(
                aspectRatio: _controller.value.aspectRatio,
                // Use the VideoPlayer widget to display the video.
                child: VideoPlayer(_controller),
                // child: Stack(
                //   alignment: Alignment.bottomCenter,
                //   children: <Widget>[
                //     VideoPlayer(_controller),
                //     VideoProgressIndicator(_controller, allowScrubbing: true),
                //   ],
                // ),
              );
            } else {
              // If the VideoPlayerController is still initializing, show a
              // loading spinner.
              return const Center(child: CircularProgressIndicator());
            }
          },
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: () {
            setState(() {
              _controller.value.isPlaying
                  ? _controller.pause()
                  : _controller.play();
            });
          },
          child: Icon(
            _controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
          ),
        ),
      ),
    );
  }

  @override
  void dispose() {
    super.dispose();
    _controller.dispose();
  }
}

/*class GalleryApp extends StatelessWidget {
  const GalleryApp({
    Key key,
    this.initialRoute,
    this.isTestMode = false,
  }) : super(key: key);

  final bool isTestMode;
  final String initialRoute;

  @override
  Widget build(BuildContext context) {
    return ModelBinding(
      initialModel: GalleryOptions(
        themeMode: ThemeMode.system,
        textScaleFactor: systemTextScaleFactorOption,
        customTextDirection: CustomTextDirection.localeBased,
        locale: null,
        timeDilation: timeDilation,
        platform: defaultTargetPlatform,
        isTestMode: isTestMode,
      ),
      child: Builder(
        builder: (context) {
          return MaterialApp(
            // By default on desktop, scrollbars are applied by the
            // ScrollBehavior. This overrides that. All vertical scrollables in
            // the gallery need to be audited before enabling this feature,
            // see https://github.com/flutter/gallery/issues/523
            scrollBehavior:
                const MaterialScrollBehavior().copyWith(scrollbars: false),
            restorationScopeId: 'rootGallery',
            title: 'Flutter Gallery',
            debugShowCheckedModeBanner: false,
            themeMode: GalleryOptions.of(context).themeMode,
            theme: GalleryThemeData.lightThemeData.copyWith(
              platform: GalleryOptions.of(context).platform,
            ),
            darkTheme: GalleryThemeData.darkThemeData.copyWith(
              platform: GalleryOptions.of(context).platform,
            ),
            localizationsDelegates: const [
              ...GalleryLocalizations.localizationsDelegates,
              LocaleNamesLocalizationsDelegate()
            ],
            initialRoute: initialRoute,
            supportedLocales: GalleryLocalizations.supportedLocales,
            locale: GalleryOptions.of(context).locale,
            localeListResolutionCallback: (locales, supportedLocales) {
              deviceLocale = locales.first;
              return basicLocaleListResolution(locales, supportedLocales);
            },
            onGenerateRoute: RouteConfiguration.onGenerateRoute,
          );
        },
      ),
    );
  }
}

class RootPage extends StatelessWidget {
  const RootPage({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const ApplyTextOptions(
      child: SplashPage(
        child: Backdrop(),
      ),
    );
  }
}*/

[linux_serial] unclear timeout behaviour

I have a usecase where I need to communicate with devices to identify them, and I can't rule out that sometimes a device doesn't give me replies at all. This is where the timeout behaviour of the serial port becomes important, in order to not loose time and get performant behaviour.
So I tried to find out how this library behaves regarding timeouts.
In makeRaw you are setting:

    ptr.ref.c_cc[VMIN] = 0;
    ptr.ref.c_cc[VTIME] = 0;

In makeRawAndSetBaudrate you are setting:

    ptr.ref.c_cc[VMIN] = 1;
    ptr.ref.c_cc[VTIME] = 100;

According to https://man7.org/linux/man-pages/man3/termios.3.html -> noncanonical mode, the first case means polling read (give back what is available) while the second case means to block until the first character was received and then to have 10 seconds (unit is tenth's of seconds) timeout between characters. The second case is used as soon as a baudrate has been configured.

I'd like to understand the reasoning behind these settings - what did you have in mind here? Would you consider adding a configurable timeout to this library, or would you at least accept a PR that implements such a feature?

ODROID C4 support

hello!

I'm trying to compile and deploy a sample application ODROID C4 but when I run the app it crashes:

E/flutter ( 4463): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'libc.so.6': dlopen failed: library "libc.so.6" not found
E/flutter ( 4463): #0      _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11:55)
E/flutter ( 4463): #1      new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:20:12)
E/flutter ( 4463): #2      new PlatformInterface._private (package:flutter_gpiod/src/gpiod.dart:189:42)
E/flutter ( 4463): #3      PlatformInterface.instance (package:flutter_gpiod/src/gpiod.dart:240:37)
E/flutter ( 4463): #4      FlutterGpiod.instance (package:flutter_gpiod/src/gpiod.dart:668:43)
E/flutter ( 4463): #5      main (package:marchivum/main.dart:9:30)
E/flutter ( 4463): #6      _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:145:25)
E/flutter ( 4463): #7      _rootRun (dart:async/zone.dart:1428:13)
E/flutter ( 4463): #8      _CustomZone.run (dart:async/zone.dart:1328:19)
E/flutter ( 4463): #9      _runZoned (dart:async/zone.dart:1863:10)
E/flutter ( 4463): #10     runZonedGuarded (dart:async/zone.dart:1851:12)
E/flutter ( 4463): #11     _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:141:5)
E/flutter ( 4463): #12     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:283:19)
E/flutter ( 4463): #13     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
E/flutter ( 4463): 
Syncing files to device ODROID C4...                                90ms

Do I need to install anything on my development machine (like, the Android NDK?). Is the ODROID C4 supported?

thanks!

Add an argument to determine which sound device to use for audio

It would be beneficial to be able to specify which sound output device that omxplayer should use. In some instances I would like to use the omxplayer -o alsa option, for example, so that audio can be routed to the alsa driver which is configured to play audio as required by the hardware. The default option for omxplayer is that it plays audio through the hdmi port, which doesn't help if the user has headphones (or another sound system) connected to the pi.

Permission denied, errno = 13

Hello!
I started to use https://pub.dev/packages/linux_serial this package, but after I run on Android 11 mobile and called the below function I got an error.
final ports = SerialPorts.ports; print(ports);

Error:
Directory listing failed, path = '/sys/dev/char/' (OS Error: Permission denied, errno = 13)

Stack:

#0      _Directory._fillWithDirectoryListing (dart:io-patch/directory_patch.dart:42:24)
#1      _Directory.listSync (dart:io/directory_impl.dart:243:5)
#2      SerialPorts.ports (package:linux_serial/src/linux_serial.dart:581:7)
#3      _MyHomePageState._incrementCounter (package:usb_serial_test/main.dart:37:31)
#4      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:1005:21)
#5      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:198:24)
#6      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:613:11)
#7      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:298:5)

I got the same error, when I used these packages: https://pub.dev/packages/libserialport , https://pub.dev/packages/flutter_libserialport

What kind of permission should I grant?
Thank you in advance!

Flutter version:

Flutter 3.0.0
Framework • revision ee4e09cce0 (8 months ago) • 2022-05-09 16:45:18 -0700
Engine • revision d1b9a6938a
Tools • Dart 2.17.0 • DevTools 2.12.2

[linux_can] Would it be possible to add CAN FD support to linux_can ?

Hi,

first of all, great work on your repositories, I have checked out and played with the linux_can and it looks very good, I plan to use that together with the flutter-pi. Thanks for all that great work.

I am noob programmer, so can't do it myself really, unless there is someone willing to provide some guidance.

Camera Video/Photo Capture?

Hi, amazing job! I'm so delighted to play video and see camera preview on my RPi2b :)

Wondering how do we capture video and photos from the camera?

Thank!

gstreamer_video_player - issue on looping

@ardera I'm facing this issue on looping the video.

plugins/gstreamer_video_player/player.c: last gstreamer state change failed. gst_element_get_state(element name: pipeline0): GST_STATE_CHANGE_FAILURE
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(nativeerror, Input/output error, 5, null)
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652:7)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310:18)
<asynchronous suspension>
#2      FlutterpiVideoPlayer.getPosition (package:flutterpi_gstreamer_video_player/src/platform.dart:155:20)
<asynchronous suspension>
#3      VideoPlayerController._applyPlayPause.<anonymous closure> (package:video_player/video_player.dart:582:41)
<asynchronous suspension>

Any possible solution to loop the video, the code used is from the example of the package.

Advisory on Continuous Read Stream

Hello!

I'm trying to get some form of continuous read from a serial port going. Ideally I just listen to the stream that the SerialPortHandle after open() contains, but that doesn't seem to be working how I expect.

I'm able to read fine, I just want to have a psuedo serial console for the user. Not fully interactive, since the payloads that get written to port are predefined, but I do want to just keep reading and never stop - continually adding to TextField in read only mode.

Video Player

hi,
omxplayer is not support arm64 , What's the solution for arm64?

iterable<int> is not a subtype of List<int> in writeBytes

Im not good at github lol but I have a bug and a fix for it.
Line 852 in linux_serial.dart:
bytes = bytes.skip(_bufferSize) as List<int>;

needs to be

bytes = bytes.skip(_bufferSize).toList();

Sorry I dont know how to make a pull request.

[linux_serial] 'libc.so.6'

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'libc.so.6': dlopen failed: library "libc.so.6" not found

Print statements in flutter_gpiod package

The flutter_gpiod package contains some print statements that aren't useful:

 print('before isolate.spawn');

    Isolate.spawn(
      _eventIsolateEntry2,
      [
        receivePort.sendPort,
        epollFd,
      ],
      onError: errorReceivePort.sendPort,
      debugName: 'flutter_gpiod event listener',
    );

    print('after isolate.spawn');

Can these be removed?

Unify generated libc platform bindings

now that the generated libc platform bindings are portable (i.e. the same for each ABI, so linux-armhf, arm64, i386 and amd64), the old boilerplate code that was there to wrap the platform-specific bindings and provide a common API can be deleted and we can just use the bindings that are generated for amd64 (for example).

Though we should still generate the bindings for all platforms and check whether they are the same, so for example we catch outliers such as O_NOFOLLOW and O_DIRECTORY, which have different values depending on ABI.

Chips Number return 0

Hi Ardera Team,

I'm new in Flutter. I have a problem when running

_final chips = FlutterGpiod.instance.chips;

It's always return 0 on my code. I'm using raspberry pi 4 and FydeOS for Raspberry.

When I run command "sudo gpiodetect" on Chrome shell, it's return gpiochip0 and gpiochip1

Support linux GPIO v2 API

The linux kernels GPIO interface changed in version 5.10. A new version of the interface was introduced and the old one deprecated. The new interface is functionally backwards compatible to the old one (but not ABI-compatible) but introduces some new features that may be useful, for example, no more differentiation between a requested line and an event line (so we can possibly reconfigure a line requested as input to a line that's listening on some signal edges now).

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.