initialize method

  1. @override
Future<Parse> initialize(
  1. String appId,
  2. String serverUrl,
  3. {bool debug = false,
  4. String? appName,
  5. String? appVersion,
  6. String? appPackageName,
  7. String? locale,
  8. String? liveQueryUrl,
  9. String? clientKey,
  10. String? masterKey,
  11. String? sessionId,
  12. bool autoSendSessionId = true,
  13. SecurityContext? securityContext,
  14. CoreStore? coreStore,
  15. Map<String, ParseObjectConstructor>? registeredSubClassMap,
  16. ParseUserConstructor? parseUserConstructor,
  17. ParseFileConstructor? parseFileConstructor,
  18. List<int>? liveListRetryIntervals,
  19. ParseConnectivityProvider? connectivityProvider,
  20. String? fileDirectory,
  21. Stream<void>? appResumedStream,
  22. ParseClientCreator? clientCreator}
)
override

To initialize Parse Server in your application

This should be initialized in MyApp() creation

Parse().initialize(
       "PARSE_APP_ID",
       "https://parse.myaddress.com/parse/,
       clientKey: "asd23rjh234r234r234r",
       debug: true,
       liveQuery: true);

appName, appVersion and appPackageName are automatically set on Android and IOS, if they are not defined. You should provide a value on web. fileDirectory is not used on web

Implementation

@override
Future<Parse> initialize(
  String appId,
  String serverUrl, {
  bool debug = false,
  String? appName,
  String? appVersion,
  String? appPackageName,
  String? locale,
  String? liveQueryUrl,
  String? clientKey,
  String? masterKey,
  String? sessionId,
  bool autoSendSessionId = true,
  SecurityContext? securityContext,
  sdk.CoreStore? coreStore,
  Map<String, sdk.ParseObjectConstructor>? registeredSubClassMap,
  sdk.ParseUserConstructor? parseUserConstructor,
  sdk.ParseFileConstructor? parseFileConstructor,
  List<int>? liveListRetryIntervals,
  sdk.ParseConnectivityProvider? connectivityProvider,
  String? fileDirectory,
  Stream<void>? appResumedStream,
  sdk.ParseClientCreator? clientCreator,
}) async {
  if (appName == null || appVersion == null || appPackageName == null) {
    final PackageInfo packageInfo = await PackageInfo.fromPlatform();
    appName ??= packageInfo.appName;
    appVersion ??= packageInfo.version;
    appPackageName ??= packageInfo.packageName;
  }

  return await super.initialize(
    appId,
    serverUrl,
    debug: debug,
    appName: appName,
    appVersion: appVersion,
    appPackageName: appPackageName,
    locale: locale ??
        (sdk.parseIsWeb
            ? PlatformDispatcher.instance.locale.toString()
            : Platform.localeName),
    liveQueryUrl: liveQueryUrl,
    clientKey: clientKey,
    masterKey: masterKey,
    sessionId: sessionId,
    autoSendSessionId: autoSendSessionId,
    securityContext: securityContext,
    coreStore: coreStore ?? await CoreStoreSharedPrefsImp.getInstance(),
    registeredSubClassMap: registeredSubClassMap,
    parseUserConstructor: parseUserConstructor,
    parseFileConstructor: parseFileConstructor,
    liveListRetryIntervals: liveListRetryIntervals,
    connectivityProvider: connectivityProvider ?? this,
    fileDirectory:
        fileDirectory ?? (await CoreStoreDirectory().getTempDirectory()),
    appResumedStream: appResumedStream ?? _appResumedStreamController.stream,
    clientCreator: clientCreator,
  ) as Parse;
}