remember this flutter code as part 1
import 'dart:convert';
import 'dart:developer';

import 'package:efendim\_user/custom\_widget/alternative\_button.dart';
import 'package:efendim\_user/helper/consts.dart';
import 'package:efendim\_user/helper/dialog\_utils.dart';
import 'package:efendim\_user/helper/global\_translations.dart';
import 'package:efendim\_user/helper/pref\_manager.dart';
import 'package:efendim\_user/helper/utils.dart';
import 'package:efendim\_user/provider/general.dart';
import 'package:efendim\_user/provider/home.dart';
import 'package:efendim\_user/view/auth/login/login\_view.dart';
import 'package:get/get.dart';
import 'package:efendim\_user/view/home/home\_widget/search\_page.dart';
import 'package:efendim\_user/view/specific\_merchant/specific\_merchant\_view.dart';
import 'package:efendim\_user/view/src/resources/repository.dart';
import 'package:efendim\_user/view/src/ui/home/qrcode\_scanner.dart';
import '../../widgets/home/newCategWidget.dart';
import 'delivery\_location\_picker.dart';
import 'package:efendim\_user/view/src/ui/wallet/wallet.dart';
import 'package:efendim\_user/view/src/widgets/home/all\_merchants\_widget.dart';
import 'package:efendim\_user/view/src/widgets/home/banner\_widget.dart';
import 'package:efendim\_user/view/src/widgets/home/categories\_widget.dart';
import 'package:efendim\_user/view/src/widgets/home/favorites\_widget.dart';
import 'package:efendim\_user/view/src/widgets/home/near\_by\_widget.dart';
import 'package:efendim\_user/view/src/widgets/home/offers\_widget.dart';
import 'package:efendim\_user/view/src/widgets/home/featured\_widget.dart';
import 'package:flutter/material.dart';
import 'package:google\_maps\_flutter/google\_maps\_flutter.dart';
import 'package:lottie/lottie.dart';
import 'package:provider/provider.dart';
import 'package:url\_launcher/url\_launcher.dart';
import 'package:flutterfire\_installations/flutterfire\_installations.dart';
import 'package:firebase\_in\_app\_messaging/firebase\_in\_app\_messaging.dart';

class HomeV2 extends StatefulWidget {
 const HomeV2({Key? key}) : super(key: key);

 @override
 State createState() => \_HomeV2State();
}

class \_HomeV2State extends State {
 final \_prefManager = PrefManager();
 final \_repo = Repository();
 GlobalKey listKey = GlobalKey();

 @override
 void initState() {
 FirebaseInAppMessaging.instance.triggerEvent("testdoumi");
 super.initState();
 // FirebaseInAppMessaging.instance.triggerEvent("testdoumi");

 updateProfileAddress();
 reloadMainPage();
 }

 updateProfileAddress() async {
 var provider = Provider.of(context, listen: false);
 if (provider.userData == null) {
 return;
 }
 List names = [];
 if (provider.placemark!.subLocality!.isNotEmpty) {
 names.add(provider.placemark!.subLocality);
 }
 if (provider.placemark!.street!.isNotEmpty &&
 provider.placemark!.street != provider.placemark!.subLocality) {
 names.add(provider.placemark!.street);
 }
 if (provider.placemark!.thoroughfare!.isNotEmpty) {
 names.add(provider.placemark!.thoroughfare);
 }
 String street = names.join(", ");
 await \_repo.postData(
 "updateProfileAdress",
 {
 "street": street,
 "city": provider.placemark!.administrativeArea,
 "state": provider.placemark!.subAdministrativeArea,
 "zipcode": provider.placemark!.postalCode,
 "country\_code": provider.placemark!.isoCountryCode,
 "location\_name": street,
 "contact\_phone": provider.userData!["contact\_phone"],
 "user\_lat": provider.currentLatLng!.latitude,
 "user\_lng": provider.currentLatLng!.longitude,
 },
 forceRefresh: true);
 }

 Future reloadMainPage({bool forceRefresh = false}) async {
 var homeProvider = Provider.of(context, listen: false);
 homeProvider.loadNearBy(forceRefresh: forceRefresh);

 var generalProvider = Provider.of(context, listen: false);
 var settings = generalProvider.settings;
 var userData = generalProvider.userData;
 if (settings!["home"]["mobile2\_home\_banner"] == "1") {
 homeProvider.loadBanner(forceRefresh: forceRefresh);
 }
 if (settings["home"]["mobile2\_home\_cuisine"] == "1") {
 homeProvider.loadCuisine(forceRefresh: forceRefresh);
 }
 if (settings["home"]["mobile2\_home\_favorite\_restaurant"] == "1" &&
 userData != null) {
 homeProvider.loadFavourites(forceRefresh: forceRefresh);
 }
 if (settings["home"]["mobile2\_home\_offer"] == "1") {
 homeProvider.loadSpecialOffers(forceRefresh: forceRefresh);
 }
 if (settings["home"]["mobile2\_home\_featured"] == "1") {
 homeProvider.loadFeaturedMerchant(forceRefresh: forceRefresh);
 }
 if (settings["home"]["mobile2\_home\_all\_restaurant"] == "1") {
 homeProvider.pagingController.refresh();
 }
 await generalProvider.loadWallet();

 Future.delayed(const Duration(seconds: 2)).then((value) {
 checkCurrentAddress();
 });
 }

 @override
 void setState(fn) {
 if (mounted) {
 super.setState(fn);
 }
 }

 checkCurrentAddress() async {
 var generalProvider = Provider.of(context, listen: false);
 var temp = generalProvider.getClosestLocation();
 if (temp != null && generalProvider.currentAddress != null) {
 if (generalProvider.currentAddress!["id"] != temp["id"]) {
 bool? change = await showCustomDialog(
 title: lang.api("Address verification"),
 subtitle: Column(
 children: [
 Text(
 lang.api(
 "Your selected address ({location\_tag}) is not match your current location.",
 {
 "location\_tag":
 lang.api(generalProvider.currentAddress!["tag"]),
 }),
 textAlign: TextAlign.center,
 ),
 const SizedBox(height: 16),
 Text(
 lang.api("Do you want to change it?"),
 textAlign: TextAlign.center,
 ),
 ],
 ),
 positiveLabel: lang.api("Change"),
 negativeLabel: lang.api("No"),
 negativeColor: Colors.grey,
 positiveColor: Theme.of(context).primaryColor,
 );
 if (change ?? false) {
 showAddressSheet();
 }
 }
 }
 }
이 플러터 코드를 파트 1로 기억하세요.import 'dart:convert';import 'dart:developer';import 'package:efendim\_user/custom\_widget/alternative\_button.dart';'package:efendim\_user/helper/consts.dart'를 가져옵니다;'package:efendim\_user/helper/dialog\_utils.dart'를 가져옵니다;'package:efendim\_user/helper/global\_translations.dart'를 가져옵니다;'package:efendim\_user/helper/pref\_manager.dart'를 가져옵니다;'package:efendim\_user/helper/utils.dart'를 가져옵니다;'package:efendim\_user/provider/general.dart'를 가져옵니다;'package:efendim\_user/provider/home.dart'를 가져옵니다;'package:efendim\_user/view/auth/login/login\_view.dart' 임포트;'package:get/get.dart' 임포트;'package:efendim\_user/view/home/home\_widget/search\_page.dart' import;'package:efendim\_user/view/specific\_merchant/specific\_merchant\_view.dart'를 가져옵니다;'package:efendim\_user/view/src/resources/repository.dart'를 가져옵니다;'package:efendim\_user/view/src/ui/home/qrcode\_scanner.dart'를 가져옵니다;'../../위젯/홈/새 카테고리 위젯.dart'를 가져옵니다;'배달\_위치\_피커.dart'를 가져옵니다;'package:efendim\_user/view/src/ui/wallet/wallet.dart'를 가져옵니다;'package:efendim\_user/view/src/widgets/home/all\_merchants\_widget.dart'를 가져옵니다;'package:efendim\_user/view/src/widgets/home/banner\_widget.dart'를 가져옵니다;'package:efendim\_user/view/src/widgets/home/categories\_widget.dart'를 가져옵니다;'package:efendim\_user/view/src/widgets/home/favorites\_widget.dart'를 가져옵니다;'package:efendim\_user/view/src/widgets/home/near\_by\_widget.dart'를 가져옵니다;'package:efendim\_user/view/src/widgets/home/offers\_widget.dart'를 가져옵니다;'package:efendim\_user/view/src/widgets/home/featured\_widget.dart' 임포트;'package:flutter/material.dart'를 가져옵니다;'package:google\_maps\_flutter/google\_maps\_flutter.dart' import;import 'package:lottie/lottie.dart';'package:provider/provider.dart' import;'package:url\_launcher/url\_launcher.dart' import;'package:flutterfire\_installations/flutterfire\_installations.dart' import;'package:firebase\_in\_app\_messaging/firebase\_in\_app\_messaging.dart'를 가져옵니다;클래스 HomeV2 extends StatefulWidget { const HomeV2({키? 키}) : super(키: 키); @override State createState() => \_HomeV2State();}클래스 \_HomeV2State extends State { final \_prefManager = PrefManager(); final \_repo = Repository(); GlobalKey listKey = GlobalKey(); 오버라이드 void initState() { FirebaseInAppMessaging.instance.triggerEvent("testdoumi"); super.initState(); // FirebaseInAppMessaging.instance.triggerEvent("testdoumi"); updateProfileAddress(); reloadMainPage(); } updateProfileAddress() async { var provider = Provider.of(context, listen: false); if (provider.userData == null) { return; } 목록 이름 = []; if (provider.placemark!.subLocality!.isNotEmpty) { names.add(provider.placemark!.subLocality); } if (provider.placemark!.street!.isNotEmpty && provider.placemark!.street != provider.placemark!.subLocality) { names.add(provider.placemark!.street); } if (provider.placemark!.thoroughfare!.isNotEmpty) { names.add(provider.placemark!.thoroughfare); } 문자열 street = names.join(", "); await \_repo.postData( "updateProfileAdress", { "street": street, "city": provider.placemark!.administrativeArea, "state": provider.placemark!.subAdministrativeArea, "우편번호": provider.placemark!.postalCode, "국가\_코드": provider.placemark!.isoCountryCode, "위치\_이름": 거리, "contact\_phone": provider.userData!["contact\_phone"], "user\_lat": provider.currentLatLng!.위도, "user\_lng": provider.currentLatLng!.경도, }, forceRefresh: true); } 향후 재로드 메인 페이지({bool forceRefresh = false}) async { var homeProvider = Provider.of(context, listen: false); homeProvider.loadNearBy(forceRefresh: forceRefresh); var generalProvider = Provider.of(context, listen: false); 변 설정 = 일반 공급자.설정; var userData = generalProvider.userData; if (settings!["home"]["mobile2\_home\_banner"] == "1") { homeProvider.loadBanner(forceRefresh: forceRefresh); } if (settings["home"]["mobile2\_home\_cuisine"] == "1") { homeProvider.loadCuisine(forceRefresh: forceRefresh); } if (settings["home"]["mobile2\_home\_favorite\_restaurant"] == "1" &&& userData != null) { homeProvider.loadFavourites(forceRefresh: forceRefresh); } if (settings["home"]["mobile2\_home\_offer"] == "1") { homeProvider.loadSpecialOffers(forceRefresh: forceRefresh); } if (settings["home"]["mobile2\_home\_featured"] == "1") { homeProvider.loadFeaturedMerchant(forceRefresh: forceRefresh); } if (settings["home"]["mobile2\_home\_all\_restaurant"] == "1") { homeProvider.pagingController.refresh(); } await generalProvider.loadWallet(); Future.delayed(const Duration(seconds: 2)).then((value) { checkCurrentAddress(); }); } @override void setState(fn) { if (mounted) { super.setState(fn); } } checkCurrentAddress() async { var generalProvider = Provider.of(context, listen: false); var temp = generalProvider.getClosestLocation(); if (temp != null && generalProvider.currentAddre