Docs Menu
Docs Home
/ /
Atlas Device SDKs
/

Upgrade to Flutter SDK v2.0.0

On this page

  • Builder Changes
  • What Do I Need to Do?
  • Removed Classes and Members

Atlas Device SDK for Flutter version 2.0.0 introduces several breaking changes that impact existing apps upgrading from an earlier version.

Notably, this version of the SDK:

  • Changes the part builder and how the SDK generates files for your data model classes. This change impacts all apps upgrading from an earlier version of the SDK. Refer to the Builder Changes section on this page for information and instructions.

  • Removes or replaces several classes and members. These changes may or may not impact your app. Refer to the Removed Classes and Members section on this page for information and instructions for impacted apps.

Important

This change impacts all apps upgrading from an earlier version of the SDK.

Flutter SDK version 2.0.0 updates the SDK's realm_generator to use a PartBuilder instead of a SharedPartBuilder. This updated builder generates RealmModel data model files with a new .realm.dart file extension:

Version
File Extension
Example Part Directive
SDK v2.0.0 and later
.realm.dart
part 'car.realm.dart';
SDK v1.9.0 and earlier
.g.dart
part 'car.g.dart';

Tip

The update from SharedPartBuilder to PartBuilder makes it easier to use multiple builders in your app. For example, combining realm_dart with a serialization package builder such as dart_mappable or json_serializable.

When you upgrade an existing app from an earlier version of the Flutter SDK to version 2.0.0 or later, you must update any existing part declarations, then regenerate the object models with the new .realm.dart file extension:

1

Update all of the RealmObject part declarations in your app to use the new naming convention:

import 'package:realm_dart/realm.dart';
// Update existing declaration from .g.dart to .realm.dart
// part 'car.g.dart';
part 'car.realm.dart';
@RealmModel()
class _Car {
@PrimaryKey()
late ObjectId id;
late String make;
late String? model;
late int? miles;
}
2

After you update all of your declarations, regenerate your object models with the new .realm.dart file extension. You can safely delete any .g.dart files from your project.

dart run realm generate

After you update all of your declarations, regenerate your object models with the new .realm.dart file extension. You can safely delete any .g.dart files from your project.

dart run realm_dart generate

Flutter SDK version 2.0.0 also removed or replaced several classes, members, and properties from the SDK. These changes may or may not impact your app.

The following table outlines what was removed and why, as well as a recommended solution when upgrading an app that used the removed class or member, if any:

Removed Class or Member
Reason
Solution
AppConfiguration.localAppName and AppConfiguration.localAppVersion
Unused in SDK.
Remove any instances.
ClientResetError.isFatal
Not needed. Always true.
Remove any instances.
ClientResetError.sessionErrorCode
Consolidated into SyncErrorCode in SDK v1.6.0.
Realm.logger.level
Replaced by Realm.logger.setLogLevel.
Replace any instances. See also Logging - Flutter SDK.
RealmProperty.indexed
Replaced by RealmProperty.indexType.
Replace any instances.
RealmValue.type
Changed to an enum of RealmValueType.
Replace any instances. See also RealmValue Data Type.
RealmValue.uint8List
Renamed to RealmValue.binary.
Replace any instances. See also RealmValue Data Type.
SchemaObject.properties
SchemaObject changed to an iterable collection of SchemaProperty.
Replace any instances. See also the SchemaObject API reference.
SyncError constructor and SyncError.create factory
Sync errors should only be created internally by the SDK.
Remove any instances.
SyncClientError, SyncConnectionError, SyncSessionError, SyncResolveError, SyncWebSocketError, and GeneralSyncError
Consolidated into SyncError in SDK v1.6.0.
Use SyncError or its subclasses. See also the SyncError API reference.
SyncErrorCategory, SyncClientErrorCode, SyncConnectionErrorCode, SyncSessionErrorCode, SyncResolveErrorCode,``SyncWebsocketErrorCode``, and GeneralSyncErrorCode
Consolidated into SyncErrorCode in SDK v1.6.0.
Use SyncErrorCode enum. See also the SyncError API reference.
SyncError.codeValue, SyncError.category, and SyncError.detailedMessage
Consolidated into SyncError in SDK v1.6.0. Messages were unused.
Remove any category or message instances. Replace SyncError.codeValue with SyncError.code.code. See also the SyncError API reference.
SyncProgress.transferredBytes and SyncProgress.transferableBytes
Reported transferred and transferable values were incorrect. Consolidated into a new SyncProgress.progressEstimate metric.
Use SyncProgress.progressEstimate. See also Monitor Sync Upload and Download Progress.
User.provider
Provider is associated with each identity, so value was incorrect for users with more than one identity.
Remove any instances.

Back

SDK Telemetry