Skip to content

[DRAFT] Talker DevTools Extension#476

Draft
Frezyx wants to merge 1 commit intomasterfrom
extension
Draft

[DRAFT] Talker DevTools Extension#476
Frezyx wants to merge 1 commit intomasterfrom
extension

Conversation

@Frezyx
Copy link
Copy Markdown
Owner

@Frezyx Frezyx commented Feb 28, 2026

Screenshot 2026-02-28 at 17 25 29

Summary by Sourcery

Add a Flutter DevTools extension for Talker and wire Talker instances to expose their logs to the extension in debug mode.

New Features:

  • Introduce a Talker DevTools Flutter web extension that displays Talker logs inside Flutter DevTools.
  • Expose a VM service extension from talker_flutter so DevTools can request serialized Talker log history.
  • Automatically register Talker instances with the DevTools integration when initialized via TalkerFlutter.init in debug builds.
  • Provide DevTools configuration and options to enable the Talker tab in example apps.

Enhancements:

  • Update macOS example project configuration for newer platform and lifecycle support.
  • Adjust Talker example code to use shorthand super parameter syntax and a stubbed logger output for clarity.

Tests:

  • Add a placeholder test suite for the DevTools extension to keep the package testable pending proper web/DevTools environment tests.

@Frezyx Frezyx added enhancement New feature or request work_in_progress Сurrently under work addons Related to addons/bridge packages like dio_logger and bloc_logger labels Feb 28, 2026
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Feb 28, 2026

Reviewer's Guide

Adds a Flutter DevTools extension for Talker logs and wires it into talker_flutter so DevTools can pull log history via a VM service extension in debug mode, plus minor example and platform updates.

Sequence diagram for DevTools fetching Talker logs via VM service extension

sequenceDiagram
    actor DevToolsUser
    participant DevToolsUI
    participant TalkerDevToolsExtension
    participant DevToolsExtensionFramework
    participant ServiceManager
    participant VmServiceExtension
    participant TalkerDevTools
    participant Talker

    DevToolsUser->>DevToolsUI: Open DevTools and select Talker tab
    DevToolsUI->>TalkerDevToolsExtension: Build TalkerLogsScreen
    TalkerDevToolsExtension->>ServiceManager: callServiceExtensionOnMainIsolate(ext.talker_flutter.getLogs, since)
    ServiceManager->>VmServiceExtension: ext.talker_flutter.getLogs(since)
    VmServiceExtension->>TalkerDevTools: _serviceExtensionHandler(method, params)
    TalkerDevTools->>Talker: Read history
    Talker-->>TalkerDevTools: List<TalkerData>
    TalkerDevTools-->>VmServiceExtension: ServiceExtensionResponse.result(jsonEncode({logs,total}))
    VmServiceExtension-->>ServiceManager: Response.json
    ServiceManager-->>TalkerDevToolsExtension: Map result
    TalkerDevToolsExtension->>TalkerLogsScreen: setState with new _logs and _lastSeenIndex
    DevToolsUI-->>DevToolsUser: Render updated log list
Loading

Class diagram for Talker DevTools integration and extension UI

classDiagram
    class Talker {
      List~TalkerData~ history
    }

    class TalkerData {
      String message
      String key
      TalkerLogLevel logLevel
      String title
      DateTime time
      StackTrace stackTrace
      Object exception
      Object error
    }

    class TalkerDevTools {
      <<static>>
      -TalkerDevTools_()
      -static Talker _devToolsTalker
      -static bool _extensionRegistered
      -static const String _extensionMethodName
      +static void register(Talker talker)
      -static void _ensureExtensionRegistered()
      -static Future serviceExtensionHandler(String method, Map~String,String~ params)
      -static Map~String,dynamic~ _talkerDataToJson(TalkerData data, int index)
    }

    class TalkerFlutterExtension {
      <<extension on Talker>>
      +static Talker init(TalkerLogger logger, TalkerObserver observer, TalkerSettings settings, TalkerFilter filter)
    }

    class TalkerDevToolsExtension {
      <<StatelessWidget>>
      +TalkerDevToolsExtension()
      +Widget build(BuildContext context)
    }

    class DevToolsExtensionWidget {
      <<Widget from devtools_extensions>>
      +Widget child
    }

    class TalkerLogsScreen {
      <<StatefulWidget>>
      +TalkerLogsScreen()
      +State createState()
    }

    class TalkerLogsScreenState {
      <<State>>
      -List~Map~String,dynamic~~ _logs
      -int _lastSeenIndex
      -Timer _pollTimer
      -String _error
      -bool _loading
      +void initState()
      +void dispose()
      -Future _fetchLogs()
      +Widget build(BuildContext context)
      -Widget _buildBody(BuildContext context)
    }

    class LogEntryTile {
      <<StatefulWidget>>
      +LogEntryTile(Map~String,dynamic~ log)
      +Map~String,dynamic~ log
      +State createState()
    }

    class LogEntryTileState {
      <<State>>
      -bool _expanded
      +Widget build(BuildContext context)
      -Color _colorForLevel(String level)
    }

    class DetailBlock {
      <<StatelessWidget>>
      +DetailBlock(String title, String content)
      +Widget build(BuildContext context)
    }

    TalkerDevTools ..> Talker : uses for history
    TalkerDevTools ..> TalkerData : serializes
    TalkerFlutterExtension ..> TalkerDevTools : calls register in kDebugMode
    TalkerDevToolsExtension ..|> StatelessWidget
    TalkerLogsScreen ..|> StatefulWidget
    TalkerLogsScreenState ..|> State
    LogEntryTile ..|> StatefulWidget
    LogEntryTileState ..|> State
    DetailBlock ..|> StatelessWidget

    TalkerDevToolsExtension o--> DevToolsExtensionWidget : wraps as child
    DevToolsExtensionWidget o--> TalkerLogsScreen : child
    TalkerLogsScreen o--> TalkerLogsScreenState : creates
    LogEntryTile o--> LogEntryTileState : creates
    LogEntryTileState o--> DetailBlock : displays details
Loading

File-Level Changes

Change Details Files
Wire Talker instances to DevTools via a VM service extension in debug mode.
  • Change TalkerFlutter.init from expression-bodied to block, storing the created Talker in a local variable before returning it
  • Import base talker package instead of talker_flutter within the extension file to avoid circular dependency
  • Automatically register the created Talker with TalkerDevTools in kDebugMode so DevTools can access its log history
packages/talker_flutter/lib/src/extensions/talker_flutter.dart
Expose a VM service extension that returns Talker history as JSON for DevTools to consume.
  • Introduce TalkerDevTools helper with a static register method to keep a single Talker instance for DevTools
  • Register a Dart VM service extension ext.talker_flutter.getLogs once per process
  • Implement service extension handler that reads talker.history, supports an optional since index parameter, and serializes log entries with metadata like time, level, and stack trace
packages/talker_flutter/lib/src/devtools/talker_devtools_extension.dart
Implement the DevTools-side Flutter web UI that polls the VM service and displays Talker logs in a console-like list.
  • Create TalkerLogsScreen widget that uses DevTools serviceManager to periodically call the ext.talker_flutter.getLogs extension and maintain an in-memory log list with incremental fetching
  • Render log entries with time, level badge, title, and message plus expandable detail blocks for exceptions, errors, and stack traces
  • Add main.dart that wraps TalkerLogsScreen in a DevToolsExtension widget so it integrates into the DevTools tab system
packages/talker_flutter/extension/lib/src/talker_logs_screen.dart
packages/talker_flutter/extension/lib/main.dart
Configure and build the DevTools extension as a standalone Flutter web app.
  • Add a dedicated pubspec for talker_devtools_extension with Flutter and devtools_extensions dependencies
  • Add web entrypoint files (index.html, manifest.json) for the extension app
  • Add DevTools config file mapping the extension to the talker_flutter package, with icon and issue tracker
  • Provide a build_extension.sh helper to build the Flutter web app and copy artifacts under extension/devtools/build
  • Add minimal analysis options and placeholder widget test for the extension package
packages/talker_flutter/extension/pubspec.yaml
packages/talker_flutter/extension/web/index.html
packages/talker_flutter/extension/web/manifest.json
packages/talker_flutter/extension/devtools/config.yaml
packages/talker_flutter/extension/build_extension.sh
packages/talker_flutter/extension/analysis_options.yaml
packages/talker_flutter/extension/test/widget_test.dart
packages/talker_flutter/extension/README.md
packages/talker_flutter/extension/.gitignore
packages/talker_flutter/extension/.metadata
packages/talker_flutter/extension/pubspec.lock
Export the DevTools extension hook from talker_flutter and enable the extension in examples.
  • Export talker_devtools_extension.dart from the talker_flutter src barrel to make TalkerDevTools.register available externally
  • Add devtools_options.yaml to the talker_flutter example to enable the talker_flutter DevTools extension tab
  • Add provider extension in the shop_app_example devtools_options.yaml as an additional DevTools extension
packages/talker_flutter/lib/src/src.dart
packages/talker_flutter/example/devtools_options.yaml
examples/shop_app_example/devtools_options.yaml
Miscellaneous example and platform updates for compatibility and clarity.
  • Update talker example to inject a no-op logger output and use Dart super-initializer shorthand in YourCustomKey
  • Bump macOS deployment target in Podfile from 10.14 to 10.15
  • Add applicationSupportsSecureRestorableState override in macOS AppDelegate for example app
  • Update generated macOS project files and Podfile.lock accordingly
packages/talker/example/talker_example.dart
packages/talker_flutter/example/macos/Podfile
packages/talker_flutter/example/macos/Runner/AppDelegate.swift
packages/talker_flutter/example/macos/Podfile.lock
packages/talker_flutter/example/macos/Runner.xcodeproj/project.pbxproj
packages/talker_flutter/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Assessment against linked issues

Issue Objective Addressed Explanation
#436 Add a Flutter DevTools extension for talker_flutter that provides a dedicated DevTools tab/screen to view Talker logs.
#436 Integrate the DevTools extension with Talker so that, when an app runs in debug mode, Talker logs are exposed via a VM service extension and can be viewed in Flutter DevTools.

Possibly linked issues

  • #unknown: PR adds the Talker Flutter DevTools extension and wiring, directly implementing the requested DevTools monitor feature.
  • #0: PR adds a Talker Flutter DevTools extension and VM service hook to view logs, directly fulfilling the requested feature.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@Frezyx Frezyx linked an issue Feb 28, 2026 that may be closed by this pull request
@listepo
Copy link
Copy Markdown

listepo commented Mar 10, 2026

Any way to change the title from talker_flutter to Talker, I think it's most fancy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

addons Related to addons/bridge packages like dio_logger and bloc_logger enhancement New feature or request work_in_progress Сurrently under work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extension for Flutter DevTools

2 participants