refactor: Enable rule avoid dynamic
This commit is contained in:
parent
298a2d0760
commit
9d007815df
17 changed files with 41 additions and 35 deletions
|
|
@ -12,8 +12,14 @@ linter:
|
||||||
- omit_local_variable_types
|
- omit_local_variable_types
|
||||||
|
|
||||||
analyzer:
|
analyzer:
|
||||||
|
plugins:
|
||||||
|
- dart_code_linter
|
||||||
errors:
|
errors:
|
||||||
todo: ignore
|
todo: ignore
|
||||||
use_build_context_synchronously: ignore
|
use_build_context_synchronously: ignore
|
||||||
exclude:
|
exclude:
|
||||||
- lib/l10n/*.dart
|
- lib/l10n/*.dart
|
||||||
|
|
||||||
|
dart_code_linter:
|
||||||
|
rules:
|
||||||
|
- avoid-dynamic
|
||||||
|
|
@ -117,9 +117,9 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
bool currentlyTyping = false;
|
bool currentlyTyping = false;
|
||||||
bool dragging = false;
|
bool dragging = false;
|
||||||
|
|
||||||
void onDragEntered(dynamic _) => setState(() => dragging = true);
|
void onDragEntered(_) => setState(() => dragging = true);
|
||||||
|
|
||||||
void onDragExited(dynamic _) => setState(() => dragging = false);
|
void onDragExited(_) => setState(() => dragging = false);
|
||||||
|
|
||||||
void onDragDone(DropDoneDetails details) async {
|
void onDragDone(DropDoneDetails details) async {
|
||||||
setState(() => dragging = false);
|
setState(() => dragging = false);
|
||||||
|
|
@ -213,7 +213,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
context.go('/rooms');
|
context.go('/rooms');
|
||||||
}
|
}
|
||||||
|
|
||||||
void requestHistory([dynamic _]) async {
|
void requestHistory([_]) async {
|
||||||
Logs().v('Requesting history...');
|
Logs().v('Requesting history...');
|
||||||
await timeline?.requestHistory(historyCount: _loadHistoryCount);
|
await timeline?.requestHistory(historyCount: _loadHistoryCount);
|
||||||
}
|
}
|
||||||
|
|
@ -265,7 +265,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _shareItems([dynamic _]) {
|
void _shareItems([_]) {
|
||||||
final shareItems = widget.shareItems;
|
final shareItems = widget.shareItems;
|
||||||
if (shareItems == null || shareItems.isEmpty) return;
|
if (shareItems == null || shareItems.isEmpty) return;
|
||||||
if (!room.otherPartyCanReceiveMessages) {
|
if (!room.otherPartyCanReceiveMessages) {
|
||||||
|
|
@ -1053,7 +1053,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
scrollController.jumpTo(0);
|
scrollController.jumpTo(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onEmojiSelected(dynamic _, Emoji? emoji) {
|
void onEmojiSelected(_, Emoji? emoji) {
|
||||||
typeEmoji(emoji);
|
typeEmoji(emoji);
|
||||||
onInputBarChanged(sendController.text);
|
onInputBarChanged(sendController.text);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
||||||
setState(() => status = AudioPlayerStatus.downloading);
|
setState(() => status = AudioPlayerStatus.downloading);
|
||||||
try {
|
try {
|
||||||
final fileSize = widget.event.content
|
final fileSize = widget.event.content
|
||||||
.tryGetMap<String, dynamic>('info')
|
.tryGetMap<String, Object?>('info')
|
||||||
?.tryGet<int>('size');
|
?.tryGet<int>('size');
|
||||||
matrixFile = await widget.event.downloadAndDecryptAttachment(
|
matrixFile = await widget.event.downloadAndDecryptAttachment(
|
||||||
onDownloadProgress: fileSize != null && fileSize > 0
|
onDownloadProgress: fileSize != null && fileSize > 0
|
||||||
|
|
@ -242,7 +242,7 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
||||||
|
|
||||||
List<int>? _getWaveform() {
|
List<int>? _getWaveform() {
|
||||||
final eventWaveForm = widget.event.content
|
final eventWaveForm = widget.event.content
|
||||||
.tryGetMap<String, dynamic>('org.matrix.msc1767.audio')
|
.tryGetMap<String, Object?>('org.matrix.msc1767.audio')
|
||||||
?.tryGetList<int>('waveform');
|
?.tryGetList<int>('waveform');
|
||||||
if (eventWaveForm == null || eventWaveForm.isEmpty) {
|
if (eventWaveForm == null || eventWaveForm.isEmpty) {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -275,7 +275,7 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
||||||
}
|
}
|
||||||
|
|
||||||
final durationInt = widget.event.content
|
final durationInt = widget.event.content
|
||||||
.tryGetMap<String, dynamic>('info')
|
.tryGetMap<String, Object?>('info')
|
||||||
?.tryGet<int>('duration');
|
?.tryGet<int>('duration');
|
||||||
if (durationInt != null) {
|
if (durationInt != null) {
|
||||||
final duration = Duration(milliseconds: durationInt);
|
final duration = Duration(milliseconds: durationInt);
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class MessageDownloadContent extends StatelessWidget {
|
||||||
final filetype = (filename.contains('.')
|
final filetype = (filename.contains('.')
|
||||||
? filename.split('.').last.toUpperCase()
|
? filename.split('.').last.toUpperCase()
|
||||||
: event.content
|
: event.content
|
||||||
.tryGetMap<String, dynamic>('info')
|
.tryGetMap<String, Object?>('info')
|
||||||
?.tryGet<String>('mimetype')
|
?.tryGet<String>('mimetype')
|
||||||
?.toUpperCase() ??
|
?.toUpperCase() ??
|
||||||
'UNKNOWN');
|
'UNKNOWN');
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class MessageReactions extends StatelessWidget {
|
||||||
|
|
||||||
for (final e in allReactionEvents) {
|
for (final e in allReactionEvents) {
|
||||||
final key = e.content
|
final key = e.content
|
||||||
.tryGetMap<String, dynamic>('m.relates_to')
|
.tryGetMap<String, Object?>('m.relates_to')
|
||||||
?.tryGet<String>('key');
|
?.tryGet<String>('key');
|
||||||
if (key != null) {
|
if (key != null) {
|
||||||
if (!reactionMap.containsKey(key)) {
|
if (!reactionMap.containsKey(key)) {
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ class _StartPollBottomSheetState extends State<StartPollBottomSheet> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _updateCanCreate([dynamic _]) {
|
void _updateCanCreate([_]) {
|
||||||
final newCanCreate =
|
final newCanCreate =
|
||||||
_bodyController.text.trim().isNotEmpty &&
|
_bodyController.text.trim().isNotEmpty &&
|
||||||
!_answers.any((controller) => controller.text.trim().isEmpty);
|
!_answers.any((controller) => controller.text.trim().isEmpty);
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class ChatEncryptionSettingsController extends State<ChatEncryptionSettings> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void enableEncryption(dynamic _) async {
|
void enableEncryption(_) async {
|
||||||
if (room.encrypted) {
|
if (room.encrypted) {
|
||||||
showOkAlertDialog(
|
showOkAlertDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class ChatMembersController extends State<ChatMembersPage> {
|
||||||
setFilter();
|
setFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFilter([dynamic _]) async {
|
void setFilter([_]) async {
|
||||||
final filter = filterController.text.toLowerCase().trim();
|
final filter = filterController.text.toLowerCase().trim();
|
||||||
|
|
||||||
final members = this.members
|
final members = this.members
|
||||||
|
|
@ -56,7 +56,7 @@ class ChatMembersController extends State<ChatMembersPage> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void refreshMembers([dynamic _]) async {
|
void refreshMembers([_]) async {
|
||||||
Logs().d('Load room members from', widget.roomId);
|
Logs().d('Load room members from', widget.roomId);
|
||||||
try {
|
try {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ class ChatSearchFilesTab extends StatelessWidget {
|
||||||
final filetype = (filename.contains('.')
|
final filetype = (filename.contains('.')
|
||||||
? filename.split('.').last.toUpperCase()
|
? filename.split('.').last.toUpperCase()
|
||||||
: event.content
|
: event.content
|
||||||
.tryGetMap<String, dynamic>('info')
|
.tryGetMap<String, Object?>('info')
|
||||||
?.tryGet<String>('mimetype')
|
?.tryGet<String>('mimetype')
|
||||||
?.toUpperCase() ??
|
?.toUpperCase() ??
|
||||||
'UNKNOWN');
|
'UNKNOWN');
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ class PIPViewState extends State<PIPView> with TickerProviderStateMixin {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onPanEnd(dynamic _) {
|
void _onPanEnd(_) {
|
||||||
if (!_isDragging) return;
|
if (!_isDragging) return;
|
||||||
|
|
||||||
final nearestCorner = _calculateNearestCorner(
|
final nearestCorner = _calculateNearestCorner(
|
||||||
|
|
@ -122,7 +122,7 @@ class PIPViewState extends State<PIPView> with TickerProviderStateMixin {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onPanStart(dynamic _) {
|
void _onPanStart(_) {
|
||||||
if (_isAnimating()) return;
|
if (_isAnimating()) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
_dragOffset = _offsets[_corner]!;
|
_dragOffset = _offsets[_corner]!;
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final fileSize = widget.event.content
|
final fileSize = widget.event.content
|
||||||
.tryGetMap<String, dynamic>('info')
|
.tryGetMap<String, Object?>('info')
|
||||||
?.tryGet<int>('size');
|
?.tryGet<int>('size');
|
||||||
final videoFile = await widget.event.downloadAndDecryptAttachment(
|
final videoFile = await widget.event.downloadAndDecryptAttachment(
|
||||||
onDownloadProgress: fileSize == null
|
onDownloadProgress: fileSize == null
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ class NewGroupController extends State<NewGroup> {
|
||||||
context.pop<String>(spaceId);
|
context.pop<String>(spaceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void submitAction([dynamic _]) async {
|
void submitAction([_]) async {
|
||||||
final client = Matrix.of(context).client;
|
final client = Matrix.of(context).client;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ class SettingsController extends State<Settings> {
|
||||||
bool? crossSigningCached;
|
bool? crossSigningCached;
|
||||||
bool? showChatBackupBanner;
|
bool? showChatBackupBanner;
|
||||||
|
|
||||||
void firstRunBootstrapAction([dynamic _]) async {
|
void firstRunBootstrapAction([_]) async {
|
||||||
if (showChatBackupBanner != true) {
|
if (showChatBackupBanner != true) {
|
||||||
showOkAlertDialog(
|
showOkAlertDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ extension LocalizedBody on Event {
|
||||||
(content['url'] is String));
|
(content['url'] is String));
|
||||||
|
|
||||||
String? get sizeString => content
|
String? get sizeString => content
|
||||||
.tryGetMap<String, dynamic>('info')
|
.tryGetMap<String, Object?>('info')
|
||||||
?.tryGet<int>('size')
|
?.tryGet<int>('size')
|
||||||
?.sizeString;
|
?.sizeString;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ class AppLock extends State<AppLockWidget> with WidgetsBindingObserver {
|
||||||
WidgetsBinding.instance.addPostFrameCallback(_checkLoggedIn);
|
WidgetsBinding.instance.addPostFrameCallback(_checkLoggedIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _checkLoggedIn(dynamic _) async {
|
void _checkLoggedIn(_) async {
|
||||||
if (widget.clients.any((client) => client.isLogged())) return;
|
if (widget.clients.any((client) => client.isLogged())) return;
|
||||||
|
|
||||||
await changePincode(null);
|
await changePincode(null);
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ class ThemeController extends State<ThemeBuilder> {
|
||||||
static ThemeController of(BuildContext context) =>
|
static ThemeController of(BuildContext context) =>
|
||||||
Provider.of<ThemeController>(context, listen: false);
|
Provider.of<ThemeController>(context, listen: false);
|
||||||
|
|
||||||
void _loadData(dynamic _) async {
|
void _loadData(_) async {
|
||||||
final preferences = _sharedPreferences ??=
|
final preferences = _sharedPreferences ??=
|
||||||
await SharedPreferences.getInstance();
|
await SharedPreferences.getInstance();
|
||||||
|
|
||||||
|
|
|
||||||
24
pubspec.lock
24
pubspec.lock
|
|
@ -165,10 +165,10 @@ packages:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: characters
|
name: characters
|
||||||
sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b
|
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.4.1"
|
version: "1.4.0"
|
||||||
charcode:
|
charcode:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -1112,18 +1112,18 @@ packages:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: matcher
|
name: matcher
|
||||||
sha256: "12956d0ad8390bbcc63ca2e1469c0619946ccb52809807067a7020d57e647aa6"
|
sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.18"
|
version: "0.12.17"
|
||||||
material_color_utilities:
|
material_color_utilities:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: material_color_utilities
|
name: material_color_utilities
|
||||||
sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b"
|
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.13.0"
|
version: "0.11.1"
|
||||||
matrix:
|
matrix:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
@ -1869,26 +1869,26 @@ packages:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test
|
name: test
|
||||||
sha256: "54c516bbb7cee2754d327ad4fca637f78abfc3cbcc5ace83b3eda117e42cd71a"
|
sha256: "75906bf273541b676716d1ca7627a17e4c4070a3a16272b7a3dc7da3b9f3f6b7"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.29.0"
|
version: "1.26.3"
|
||||||
test_api:
|
test_api:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_api
|
name: test_api
|
||||||
sha256: "93167629bfc610f71560ab9312acdda4959de4df6fac7492c89ff0d3886f6636"
|
sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.9"
|
version: "0.7.7"
|
||||||
test_core:
|
test_core:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_core
|
name: test_core
|
||||||
sha256: "394f07d21f0f2255ec9e3989f21e54d3c7dc0e6e9dbce160e5a9c1a6be0e2943"
|
sha256: "0cc24b5ff94b38d2ae73e1eb43cc302b77964fbf67abad1e296025b78deb53d0"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.15"
|
version: "0.6.12"
|
||||||
timezone:
|
timezone:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue