initialize method
- 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,
- CoreStore? coreStore,
- Map<
String, ParseObjectConstructor> ? registeredSubClassMap, - ParseUserConstructor? parseUserConstructor,
- ParseFileConstructor? parseFileConstructor,
- List<
int> ? liveListRetryIntervals, - ParseConnectivityProvider? connectivityProvider,
- String? fileDirectory,
- Stream<
void> ? appResumedStream, - 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;
}