Skip to content

Commit aba9ba3

Browse files
chore: Fix analyze issues
1 parent 66c5875 commit aba9ba3

File tree

6 files changed

+23
-19
lines changed

6 files changed

+23
-19
lines changed

packages/common/lib/src/ld_value.dart

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,15 @@ final class LDValue {
221221
/// Returns this value as an `int` if the value is numeric, otherwise returns `0`.
222222
///
223223
/// Equivalent to `LDValue.numValue().toInt()`
224-
int intValue() => _value is num ? (_value as num).toInt() : 0;
224+
int intValue() => _value is num ? _value.toInt() : 0;
225225

226226
/// Returns this value as a `double` if the value is numeric, otherwise returns `0`.
227227
///
228228
/// Equivalent to `LDValue.numValue().toDouble()`
229-
double doubleValue() => _value is num ? (_value as num).toDouble() : 0;
229+
double doubleValue() => _value is num ? _value.toDouble() : 0;
230230

231231
/// Returns this value as a `String` if the type matches, otherwise returns an empty string.
232-
String stringValue() => _value is String ? (_value as String) : '';
232+
String stringValue() => _value is String ? _value : '';
233233

234234
/// Starts building an array value.
235235
///
@@ -278,7 +278,7 @@ final class LDValue {
278278
/// Returns [ofNull] if the value is not an array or if the index is out of range.
279279
LDValue get(int index) {
280280
if (_value is _LDValueArray) {
281-
return (_value as _LDValueArray)[index];
281+
return _value[index];
282282
}
283283
return LDValue.ofNull();
284284
}
@@ -288,37 +288,37 @@ final class LDValue {
288288
/// Returns [ofNull] if the value is not an object or if the key is not found.
289289
LDValue getFor(String key) {
290290
if (_value is _LDValueObject) {
291-
return (_value as _LDValueObject)[key];
291+
return _value[key];
292292
}
293293
return LDValue.ofNull();
294294
}
295295

296296
/// Enumerates the property names in an object, returns an empty iterable for all other types.
297297
Iterable<String> get keys {
298298
if (_value is _LDValueObject) {
299-
return (_value as _LDValueObject).keys;
299+
return _value.keys;
300300
}
301301
return [];
302302
}
303303

304304
/// Enumerates the property values in an array or object, returns an empty iterable for all other types.
305305
Iterable<LDValue> get values {
306306
if (_value is _LDValueObject) {
307-
return (_value as _LDValueObject).values;
307+
return _value.values;
308308
}
309309
if (_value is _LDValueArray) {
310-
return (_value as _LDValueArray).values;
310+
return _value.values;
311311
}
312312
return [];
313313
}
314314

315315
/// Returns the number of elements in an array or object, returns `0` for all other types.
316316
int get length {
317317
if (_value is _LDValueObject) {
318-
return (_value as _LDValueObject).length;
318+
return _value.length;
319319
}
320320
if (_value is _LDValueArray) {
321-
return (_value as _LDValueArray).length;
321+
return _value.length;
322322
}
323323
return 0;
324324
}

packages/common_client/lib/src/context_modifiers/env_context_modifier.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class _Node {
153153

154154
bool tryWrite(_ISettableMap settableMap) {
155155
if (_value != null && _value != LDValue.ofNull()) {
156-
settableMap.set(_key, _value!);
156+
settableMap.set(_key, _value);
157157
return true;
158158
}
159159

@@ -162,7 +162,7 @@ class _Node {
162162
final objBuilder = LDValue.buildObject();
163163
final adaptedBuilder = _ObjectBuilderAdapter(objBuilder);
164164

165-
final wroteANode = _children!.fold(false,
165+
final wroteANode = _children.fold(false,
166166
(wroteANode, node) => wroteANode | node.tryWrite(adaptedBuilder));
167167

168168
if (!wroteANode) return false;

packages/common_client/lib/src/data_sources/data_source_manager.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ final class DataSourceManager {
127127
_statusManager.setOffline();
128128
case ConnectionMode.streaming:
129129
case ConnectionMode.polling:
130-
default:
130+
// default:
131131
// We may want to consider adding another state to the data source state
132132
// for the intermediate between switching data sources, or for identifying
133133
// a new context.

packages/event_source_client/lib/src/sse_client_html.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'dart:async';
2+
// ignore: deprecated_member_use
23
import 'dart:html' as html;
34
import 'dart:math' as math;
45

packages/flutter_client_sdk/example/lib/main.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,14 @@ class _MyHomePageState extends State<MyHomePage> {
134134
_userKeyController.text)
135135
.build())
136136
.then((value) {
137-
ScaffoldMessenger.of(context)
138-
.showSnackBar(
139-
const SnackBar(
140-
content:
141-
Text('Identify complete')),
142-
);
137+
if (context.mounted) {
138+
ScaffoldMessenger.of(context)
139+
.showSnackBar(
140+
const SnackBar(
141+
content: Text(
142+
'Identify complete')),
143+
);
144+
}
143145
});
144146
}
145147
},

packages/flutter_client_sdk/lib/src/lifecycle/js_lifecycle_listener.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'dart:async';
2+
// ignore: deprecated_member_use
23
import 'dart:html' as html;
34

45
import 'package:flutter/widgets.dart';

0 commit comments

Comments
 (0)