Простое приложение Flutter с Flutter_Map не работает - PullRequest
0 голосов
/ 02 мая 2019

Я пытаюсь запустить плагин flutter_map на флаттере. Код выглядит так:

import 'package:flutter_map/flutter_map.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new FlutterMap(
      layers: [
        new TileLayerOptions(urlTemplate:'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png')
      ],
    );
  }
}

Однако после запуска кода на моем устройстве я получаю следующую ошибку:

Performing hot reload...
Syncing files to device SM J510FN...
I/flutter (14355): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (14355): The following NoSuchMethodError was thrown building LayoutBuilder:
I/flutter (14355): The getter 'plugins' was called on null.
I/flutter (14355): Receiver: null
I/flutter (14355): Tried calling: plugins
I/flutter (14355): 
I/flutter (14355): When the exception was thrown, this was the stack:
I/flutter (14355): #0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
I/flutter (14355): #1      FlutterMapState.build.<anonymous closure>.<anonymous closure> (package:flutter_map/src/map/flutter_map_state.dart:53:62)
I/flutter (14355): #2      MappedListIterable.elementAt (dart:_internal/iterable.dart:414:29)
I/flutter (14355): #3      ListIterable.toList (dart:_internal/iterable.dart:219:19)
I/flutter (14355): #4      FlutterMapState.build.<anonymous closure> (package:flutter_map/src/map/flutter_map_state.dart:54:12)
I/flutter (14355): #5      _LayoutBuilderElement._layout.<anonymous closure> (package:flutter/src/widgets/layout_builder.dart:111:26)
I/flutter (14355): #6      BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2253:19)
I/flutter (14355): #7      _LayoutBuilderElement._layout (package:flutter/src/widgets/layout_builder.dart:107:11)
I/flutter (14355): #8      RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1728:58)
I/flutter (14355): #9      PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:797:15)
I/flutter (14355): #10     RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1728:13)
I/flutter (14355): #11     _RenderLayoutBuilder.performLayout (package:flutter/src/widgets/layout_builder.dart:205:5)
I/flutter (14355): #12     RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (14355): #13     RenderView.performLayout (package:flutter/src/rendering/view.dart:151:13)
I/flutter (14355): #14     RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1507:7)
I/flutter (14355): #15     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:766:18)
I/flutter (14355): #16     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:329:19)
I/flutter (14355): #17     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:701:13)
I/flutter (14355): #18     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:268:5)
I/flutter (14355): #19     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:988:15)
I/flutter (14355): #20     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:928:9)
I/flutter (14355): #21     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:749:7)
I/flutter (14355): #23     _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
I/flutter (14355): #24     _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
I/flutter (14355): #25     _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
I/flutter (14355): (elided one frame from package dart:async)
I/flutter (14355): ════════════════════════════════════════════════════════════════════════════════════════════════════
Reloaded 206 of 637 libraries in 7,394ms.

что я делаю не так? Обратите внимание, что я новичок в флаттере, и это мое первое испытание после урока, предоставленного домашней страницей флаттера.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...