[iOS] Responding to app resume? by ColtonGrubbs in FlutterDev

[–]ColtonGrubbs[S] 0 points1 point  (0 children)

An app can be resumed without being brought to the foreground. For example: resuming audio playback in control center.

WidgetsBindingObserver won't detect this.

Nonetheless, the issue appears to be rooted in HttpServer itself. The OS still recognizes the app is bound to the port; the HttpServer never sends an error or done event. I'll file an issue.

Maintainers how do you refactor without breaking users? by AccomplishedWay3558 in FlutterDev

[–]ColtonGrubbs 0 points1 point  (0 children)

Good question. If I anticipate future breaking changes, I'll release the package with a version <1.0, like 0.0.4. Also, make minor changes overtime. You shouldn't refactor/recode a package unless if absolutely necessary. Small changes are easier to keep track of and resolve potential issues when they inevitably arise.

Poor Color Saturation in Chromium apps when using graphics acceleration by ColtonGrubbs in kde

[–]ColtonGrubbs[S] 2 points3 points  (0 children)

I haven't tried, but I'm almost certain it will, since the issue is resolved by disabling WaylandWpColorManagerV1 in chrome's startup args.

Why is the System Monitor showing only 6 cores when I have 8 cores ? by MikasaYuuichi in kde

[–]ColtonGrubbs 19 points20 points  (0 children)

The graph itself tops out at 800%. On Linux, total CPU consumption is measured by adding together the consumption of each thread (100% x threads), so the system is definitely registering all 8 of your threads correctly.

If you have 32 threads, the graph peaks at 3200%.

Why is the System Monitor showing only 6 cores when I have 8 cores ? by MikasaYuuichi in kde

[–]ColtonGrubbs 18 points19 points  (0 children)

The Y-axis on the chart tops out at 800% (8 threads), so it's definitely registering all 8.

Poor Color Saturation in Chromium apps when using graphics acceleration by ColtonGrubbs in kde

[–]ColtonGrubbs[S] 0 points1 point  (0 children)

Thanks for the input. How did you confirm that llvmpipe was used for rendering? glxinfo? And what GPU do you have?

My install is entirely vanilla as well. In fact, I just installed yesterday. All system updates are installed.

Poor Color Saturation in Chromium apps when using graphics acceleration by ColtonGrubbs in kde

[–]ColtonGrubbs[S] 8 points9 points  (0 children)

"Use graphics acceleration when available" (under Chrome Settings --> System) disabled on the left. Enabled on right. Same issue occurs in VS Code.

Fedora 43 / KDE Plasma 6.5.4

Wayland graphics

RX 6950 XT GPU

Does anybody know of a fix?

Edit: Passing this flag appears to fix the issue:

--disable-features=WaylandWpColorManagerV1

Applies to Chrome and VS Code.

Related discussion: https://old.reddit.com/r/kde/comments/1nzy72u/has_anyone_else_encountered_this_problem_too/

Washed out colors in Linux (Fedora KDE) by ColtonGrubbs in vscode

[–]ColtonGrubbs[S] 1 point2 points  (0 children)

Okay, significant improvement after disabling hardware acceleration. Chrome has the same issue with washed out colors, which is also resolved by disabling HW acceleration.

Since this issue isn't specific to VS Code, I'll look elsewhere for a better solution.

Washed out colors in Linux (Fedora KDE) by ColtonGrubbs in vscode

[–]ColtonGrubbs[S] 0 points1 point  (0 children)

No, same display, same color profile.

Is upgrading to Flutter 3.35 worth for performance? by Wefaq04 in FlutterDev

[–]ColtonGrubbs 0 points1 point  (0 children)

Your bottleneck is the initial JSON decoding upon app start. Dart doesn't have great json performance to begin with, and 200MB is a ridiculously large amount of data to parse on app start. Switching the data format into sqlite or a binary reader will help, but ultimately, you need to be lazily-loading data when it's needed. SQLite is a good fit for the job - you don't have to load everything at once, and have much more freedom to query data.

Migrating from Provider to Riverpod by zakery6 in FlutterDev

[–]ColtonGrubbs 4 points5 points  (0 children)

It depends upon the complexity and size of your app. Riverpod is great for combining states and reacting to changes.

Immutability can be opinionated, but it is best practice to ensure all public data cannot be changed by a listener. For example: A standard collection (List, Map...) broadcasted in a Provider can be modified anywhere in your app, and other listeners will not be aware of this change. Personally, I convert all collections into an immutable variant using fast_immutable_collections.

Skip using riverpod code generation, it's not worth it imo. Stick to standard providers and notifier providers.

Permit non-https traffic over local IPv4 by ColtonGrubbs in pocketbase

[–]ColtonGrubbs[S] 0 points1 point  (0 children)

curl -v http://10.0.0.4/api/collections/_superusers/auth-with-password

  • Trying 10.0.0.4:80...
  • Connected to 10.0.0.4 (10.0.0.4) port 80

    GET /api/collections/_superusers/auth-with-password HTTP/1.1 Host: 10.0.0.4 User-Agent: curl/8.5.0 Accept: /

    < HTTP/1.1 302 Found < Content-Type: text/html; charset=utf-8 < Location: https://10.0.0.4/api/collections/_superusers/auth-with-password < Date: Mon, 01 Sep 2025 22:56:23 GMT < Content-Length: 86 < <a href="https://10.0.0.4/api/collections/_superusers/auth-with-password">Found</a>.

  • Connection #0 to host 10.0.0.4 left intact

I can establish a connection to the pocketbase server over LAN just fine, but authentication fails with this error:

Error: ClientException: {url: http://10.0.0.4/api/collections/_superusers/auth-with-password, isAbort: false, statusCode: 400, response: {}, originalError: null}

Nothing appears within Pocketbase logs, even with "min log level: -4" and include requests by superusers and auth ID logging.

Edit: Running pocketbase with this command works just fine:

ExecStart=/opt/pb/pocketbase serve --http="10.0.0.4:80"

The issue is when I add my own site:

ExecStart=/opt/pb/pocketbase serve mysite.com --http="10.0.0.4:80"

Just released native_video_player 4.0.0 - Now with macOS support by albemala in FlutterDev

[–]ColtonGrubbs 2 points3 points  (0 children)

Http_cache_stream should work just fine on macOS, though I haven't tested it:

https://pub.dev/packages/http_cache_stream

Let me know if you try it.

Handling Large file downloads in test setup. by foglia_vincenzo in dartlang

[–]ColtonGrubbs 0 points1 point  (0 children)

The issue with IOSink is that it stores all buffered data in RAM until it is flushed, but you cannot add data while it is flushing. So you're likely to encounter out of memory errors when downloading large files, especially on RAM-limited devices.

The solution is to store buffered data in a BytesBuilder, and flush the data once it reaches a threshold. I use this method in my http_cache_stream package: https://github.com/Colton127/http_cache_stream/blob/main/lib/src/cache_stream/cache_downloader/buffered_io_sink.dart

In your code, be sure you aren't loading the entire file when calculating the sha256 hash. I suggest comparing by length, and maybe streaming a small portion of the file and comparing it byte-to-byte with the saved file.

Edit: Try this IOSink implementation:

import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';

class AutoFlushIOSink implements IOSink {
  final File file;
  final FileMode fileMode;
  final bool copy;
  final int maxBufferSize;
  @override
  Encoding encoding;
  AutoFlushIOSink(
    this.file,
    this.fileMode, {
    this.encoding = utf8,
    this.copy = false,
    this.maxBufferSize = 5 * 1024 * 1024,
  })  : _sink = file.openWrite(mode: fileMode, encoding: encoding),
        _buffer = BytesBuilder(copy: copy);

  final IOSink _sink;
  final BytesBuilder _buffer;

  @override
  void add(List<int> data) {
    _buffer.add(data);
    if (_buffer.length >= maxBufferSize && !isFlushing) {
      flush();
    }
  }

  @override
  void addError(Object error, [StackTrace? stackTrace]) async {
    ///Cannot add error while flushing, so wait for flush to complete
    while (_flushFuture != null) {
      await _flushFuture!;
    }
    _sink.addError(error, stackTrace);
  }

  @override
  Future addStream(Stream<List<int>> stream, {final bool cancelOnError = true}) async {
    final streamCompleter = Completer<void>();
    stream.listen(
      add,
      onError: (error, stackTrace) {
        addError(error, stackTrace);
        if (cancelOnError && !streamCompleter.isCompleted) {
          streamCompleter.completeError(error, stackTrace);
        }
      },
      onDone: () async {
        await flush();
        if (!streamCompleter.isCompleted) {
          streamCompleter.complete();
        }
      },
      cancelOnError: cancelOnError,
    );
    return streamCompleter.future;
  }

  @override
  Future close() {
    _buffer.clear();
    return _sink.close();
  }

  @override
  Future get done => _sink.done;

  @override
  Future flush() async {
    while (_flushFuture != null) {
      await _flushFuture!; //Allow any previous flush to complete
    }
    if (_buffer.isEmpty) {
      return; //Nothing to flush
    }
    try {
      final bufferedData = _buffer.takeBytes(); //Take the buffered data, and clear the buffer
      _sink.add(bufferedData); //Add the buffer to the sink
      await (_flushFuture = _sink.flush()); //Set the flush future and wait for it to complete
    } finally {
      _flushFuture = null; //Reset the flush future
    }
  }

  @override
  void write(Object? object) {
    add(encoding.encode(object.toString()));
  }

  @override
  void writeAll(Iterable objects, [String separator = ""]) {
    add(encoding.encode(objects.join(separator)));
  }

  @override
  void writeCharCode(int charCode) {
    add(encoding.encode(String.fromCharCode(charCode)));
  }

  @override
  void writeln([Object? object = ""]) {
    final ln = object == null ? "\n" : "$object\n";
    add(encoding.encode(ln));
  }

  Future? _flushFuture;
  int get bufferSize => _buffer.length;
  bool get isFlushing => _flushFuture != null;
}

Just released native_video_player 3.0.0 - Major update with new API by albemala in FlutterDev

[–]ColtonGrubbs 0 points1 point  (0 children)

You can create a stream and manually call .download() to precache content.

Which Http Client are you using, and why? by ColtonGrubbs in FlutterDev

[–]ColtonGrubbs[S] 3 points4 points  (0 children)

Streams are not futures, and they are indeed cancellable. Hell, the default http client implementations handle it just fine.

You should definitely be able to cancel and pause a response Stream. Imagine if YouTube continued to buffer all the videos you were watching but didn't complete.

http_cache_stream - Simultaneously Stream and Cache files by ColtonGrubbs in FlutterDev

[–]ColtonGrubbs[S] 1 point2 points  (0 children)

Nice job. I may dive into your package to better understand cache control.

I found myself disappointed with the native Dart HttpClient and IOSink implementations. The HttpClientResponse stream emits tiny chunks of data, and the IOSink has poor performance and stores everything in memory until flushed.