Fixing a flutter lint for late variable

Issue I have the following flutter dart code which uses the geolocator package. Position? _position; void _getCurrentLocation() async { showDialog( context: context, builder: (context) { return const Center(child: CircularProgressIndicator()); }); Position position = await _determinePosition(); if (!mounted) return; setState(() {

Continue reading

flutter – LateInitializationError: Field 'currentPosition' has not been initialized

Issue import ‘package:flutter/material.dart’; import ‘package:geolocator/geolocator.dart’; import ‘package:kakao_map_plugin/kakao_map_plugin.dart’; class MapPage extends StatefulWidget { const MapPage({Key? key}) : super(key: key); @override State<MapPage> createState() => _MapPageState(); } class _MapPageState extends State<MapPage> { late Position? currentPosition; late KakaoMapController _mapController; @override void initState() { super.initState();

Continue reading