未处理的异常:FormatException:在 flutter

问题描述

这是我试图循环的字符串,所以我尝试将其转换为 JSON。

{to_address_mobile: [The to address mobile field is required.],to_address_area_number_id: [The to address area number id field is required.]}

这是我尝试这样做的方法

          for (var validationError in json.decode('[${resp['data']}]')){
            print(validationError);
          }

每次都出现这个错误

E/Flutter (22342): [ERROR:Flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: FormatException: Unexpected character (at character 3)
E/Flutter (22342): [{to_address_mobile: [The to address mobile field is required.],to_address...

解决方法

我写了一个正则表达式模式来从你的字符串中提取信息。如果它不是最佳选择,我很抱歉,但我从未真正使用过正则表达式:

from moviepy.editor import VideoFileClip
import moviepy.video.fx.all as vfx
clip = VideoFileClip(file_name)
resized_clip = clip .crop(clip,x1=0,y1=0,x2=1920,y2=1080)

单个匹配项是键值对,键位于命名组“key”中,值位于命名组“value”中。