Detecting IBeacon in flutter ios side

In flutter developing I need IBeacon detection and scanning it in all sides. In android I do it well and there is no issue.

Now in ios side, i wrote my own plugin with using CoreLocation library and detection beacon with location manager.

its work as well and all is good.

But when i close app and location permission is always, after detection IBeacon, My app go to some bad vision, all texts all invisible and bad visual effects.

I actually set some issue in flutter in this link.

this is my ios side code

import CoreLocation
import Foundation
import UIKit

public class BeaconMainClass: NSObject, CLLocationManagerDelegate {

var onBeacon:BeaconDelegate!

var locationManager : CLLocationManager!

public var beaconRegion = CLBeaconRegion(proximityUUID: 
UUID(uuidString: "9a71beb2-0e89-4175-b7a8-6167781d1d3c")!,identifier: 

var isDeliverd = false

    self.locationManager = locationManager
    self.onBeacon = beaconListener

    self.locationManager.delegate = self



public func startMonitoring() {
    locationManager.startMonitoring(for: self.beaconRegion)
    debugPrint("monitoring started")


public func stopMonitoring(){
    locationManager.stopMonitoring(for: self.beaconRegion)
    debugPrint("monitoring stopped")


public func startRanging(){
    locationManager.startRangingBeacons(in: self.beaconRegion)
    debugPrint("ranging start")
public func stopRanging(){
    locationManager.stopRangingBeacons(in: self.beaconRegion)
    debugPrint("ranging stop")


public func locationManager(_ manager: CLLocationManager, 
didEnterRegion region: CLRegion) {
    if CLLocationManager.isRangingAvailable() {
        debugPrint("enter region")


public func locationManager(_ manager: CLLocationManager, 
didExitRegion region: CLRegion) {
    debugPrint("exit region")
    isDeliverd = false


public func locationManager(_ manager: CLLocationManager, 
didRangeBeacons beacons: [CLBeacon], in region: CLBeaconRegion) {
    let knownBeacons = beacons.filter{ $0.proximity != 
CLProximity.unknown }
        if knownBeacons.count > 0 {
            for beacon in knownBeacons {
                if beacon.proximity == CLProximity.immediate {
                    if !isDeliverd {
                        isDeliverd = true
                        self.onBeacon.onBeaconReady(beacon: beacon)
                    }else {