'App is crashing in IOS - The client has already been terminated

I have develope flutter app in that I have implement isolate function. After implementing isolate function app is crashing while app is launch.

In isolate function I am initializing Firebase.

await Firebase.initializeApp();

When process is done in isolate function I am terminating firebase.

await FirebaseFirestore.instance.terminate();
await FirebaseFirestore.instance.clearPersistence();

Below error log is showing while app was crash :

Incident Identifier: D3E1DB0C-893F-43CA-909A-49C5DA68F8DF
CrashReporter Key:   28B3B2E4-C62D-80C4-F0D1-42AAE9E88E5E
Hardware Model:      iMac18,1
Process:             Runner [16596]
Path:                /Users/USER/Library/Developer/CoreSimulator/Devices/558D2DD4-FC71-4C6F-9007-9D369BEAADB8/data/Containers/Bundle/Application/B212F0D3-7088-46E2-A104-AC24B8079688/Runner.app/Runner
Identifier:          -----
Version:             -----
Code Type:           X86-64 (Native)
Role:                Foreground
Parent Process:      launchd_sim [852]
Coalition:           com.apple.CoreSimulator.SimDevice.558D2DD4-FC71-4C6F-9007-9D369BEAADB8 [800]
Responsible Process: SimulatorTrampoline [844]

Date/Time:           2022-01-13 19:45:40.6432 +0530
Launch Time:         2022-01-13 19:43:15.5481 +0530
OS Version:          macOS 12.0.1 (21A559)
Release Type:        User
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Application Specific Information:
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
CoreSimulator 776.4 - Device: iPhone 8 Plus (********-****-****-****-************) - Runtime: iOS 15.0 (19A339) - DeviceType: iPhone 8 Plus
terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'FIRIllegalStateException', reason: 'The client has already been terminated.'
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
abort() called

Please help me solve this, thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source