From 67c74a59bada703a6183226bac38b36dd4ceae87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20=C3=96zberk?= <83654764+ahmet-ozberk@users.noreply.github.com> Date: Tue, 2 Apr 2024 13:14:42 +0300 Subject: [PATCH] Update code_controller.dart The error that the patternMap variable is not updated is not resolved with the copyWith method. The source of the error is line 86: patternList.addAll(patternMap!.keys.map((e) => r'($e)')); the patternMap variable could not be updated because r'($e)' was written as '($e)' in this line. The error has been fixed. --- lib/src/code_field/code_controller.dart | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/lib/src/code_field/code_controller.dart b/lib/src/code_field/code_controller.dart index 082f71b..4ea81e1 100644 --- a/lib/src/code_field/code_controller.dart +++ b/lib/src/code_field/code_controller.dart @@ -1,4 +1,3 @@ -// ignore_for_file: public_member_api_docs, sort_constructors_first import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:highlight/highlight_core.dart'; @@ -83,7 +82,7 @@ class CodeController extends TextEditingController { _styleList.addAll(stringMap!.values); } if (patternMap != null) { - patternList.addAll(patternMap!.keys.map((e) => '($e)')); + patternList.addAll(patternMap!.keys.map((e) => r'($e)')); _styleList.addAll(patternMap!.values); } _styleRegExp = RegExp(patternList.join('|'), multiLine: true); @@ -303,26 +302,4 @@ class CodeController extends TextEditingController { } return TextSpan(text: text, style: style); } - - CodeController copyWith({ - Mode? _language, - CodeAutoComplete? autoComplete, - Map? patternMap, - Map? stringMap, - EditorParams? params, - List? modifiers, - String? _languageId, - RegExp? _styleRegExp, - }) { - return CodeController( - _language: _language ?? this._language, - autoComplete: autoComplete ?? this.autoComplete, - patternMap: patternMap ?? this.patternMap, - stringMap: stringMap ?? this.stringMap, - params: params ?? this.params, - modifiers: modifiers ?? this.modifiers, - _languageId: _languageId ?? this._languageId, - _styleRegExp: _styleRegExp ?? this._styleRegExp, - ); - } }