RestToOfflineFirstConverter class

Convert a JSON API payload into an OfflineFirstModel, output via generate or saveToFile.

This will not map associations or non-primitive types.

Constructors

RestToOfflineFirstConverter({required String endpoint, Map<String, String>? headers, String? topLevelKey})

Properties

client ↔ Client
Only set client when testing
getter/setter pair
endpoint String
Fully-qualified http URL with path
final
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>?
Any extra headers to pass in the GET call
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
topLevelKey String?
For properties nested one level deep
final

Methods

generate([Map<String, dynamic>? passedFields]) Future<String>
Output a usable class annotated by @ConnectOfflineFirstWithRest and extending OfflineFirstModel.
generateConstructorFields(Map<String, dynamic> fields) String
Produce fields to be invoked in the default constructor
generateFields(Map<String, dynamic> fields) String
Produce instance fields
getRestPayload() Future<Map<String, dynamic>>
Fetch from the rest endpoint
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
saveToFile([String? filePath]) Future<File>
Save generated class to file. Defaults to brick/models/LAST_ENDPOINT_PATH.dart
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

toCamelCase(String input) String
Converts a_variable_name to aVariableName