Skip to content

Commit

Permalink
chore: only add devtools observer when in debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
D-James-GH committed Mar 11, 2024
1 parent ef621f1 commit be8f1ca
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
1 change: 1 addition & 0 deletions examples/full/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:io';

import 'package:cached_query_flutter/cached_query_flutter.dart';
import 'package:cached_storage/cached_storage.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:full/observer.dart';

Expand Down
34 changes: 17 additions & 17 deletions examples/full/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051
sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7"
url: "https://pub.dev"
source: hosted
version: "64.0.0"
version: "67.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893"
sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d"
url: "https://pub.dev"
source: hosted
version: "6.2.0"
version: "6.4.1"
args:
dependency: transitive
description:
Expand Down Expand Up @@ -101,10 +101,10 @@ packages:
dependency: transitive
description:
name: built_value
sha256: a3ec2e0f967bc47f69f95009bb93db936288d61d5343b9436e378b28a2f830c6
sha256: fedde275e0a6b798c3296963c5cd224e3e1b55d0e478d5b7e65e6b540f363a0e
url: "https://pub.dev"
source: hosted
version: "8.9.0"
version: "8.9.1"
cached_query:
dependency: "direct overridden"
description:
Expand Down Expand Up @@ -202,10 +202,10 @@ packages:
dependency: transitive
description:
name: dart_style
sha256: "40ae61a5d43feea6d24bd22c0537a6629db858963b99b4bc1c3db80676f32368"
sha256: "99e066ce75c89d6b29903d788a7bb9369cf754f7b24bf70bf4b6d6d6b26853b9"
url: "https://pub.dev"
source: hosted
version: "2.3.4"
version: "2.3.6"
dbus:
dependency: transitive
description:
Expand All @@ -226,10 +226,10 @@ packages:
dependency: transitive
description:
name: ffi
sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878"
sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
version: "2.1.2"
file:
dependency: transitive
description:
Expand Down Expand Up @@ -313,10 +313,10 @@ packages:
dependency: "direct main"
description:
name: http
sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba
sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
version: "1.2.1"
http_multi_server:
dependency: transitive
description:
Expand Down Expand Up @@ -670,18 +670,18 @@ packages:
dependency: transitive
description:
name: web
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
url: "https://pub.dev"
source: hosted
version: "0.3.0"
version: "0.5.1"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b
sha256: "1d8e795e2a8b3730c41b8a98a2dff2e0fb57ae6f0764a1c46ec5915387d257b2"
url: "https://pub.dev"
source: hosted
version: "2.4.0"
version: "2.4.4"
xml:
dependency: transitive
description:
Expand All @@ -699,5 +699,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.2.0 <4.0.0"
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.16.0"
1 change: 1 addition & 0 deletions packages/cached_query/lib/cached_query.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export 'src/query_observer.dart';
export 'src/query_state.dart';
export 'src/storage_interface.dart';
export 'src/query_logging_observer.dart';
export 'src/devtools_observer.dart';
8 changes: 7 additions & 1 deletion packages/cached_query/lib/src/cached_query.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:async';
import 'dart:convert';
import "dart:developer" as developer;

import 'package:cached_query/cached_query.dart';
import 'package:cached_query/src/devtools_observer.dart';
Expand Down Expand Up @@ -107,8 +108,13 @@ class CachedQuery {
_storage = storage;
_configSet = true;
if (observers != null) {
this.observers = [...observers, DevtoolsObserver()];
this.observers = observers;
}

assert(() {
this.observers.add(DevtoolsObserver());
return true;
}());
}

/// Get a [Query] at a given key.
Expand Down

0 comments on commit be8f1ca

Please sign in to comment.