-
-
Notifications
You must be signed in to change notification settings - Fork 529
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #818 from navaronbracke/reorganise_classes
feat: Move classes into their own files
- Loading branch information
Showing
18 changed files
with
549 additions
and
428 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import 'package:mobile_scanner/src/enums/address_type.dart'; | ||
|
||
/// An address. | ||
class Address { | ||
/// Creates a new [Address] instance. | ||
const Address({ | ||
this.addressLines = const <String>[], | ||
this.type = AddressType.unknown, | ||
}); | ||
|
||
/// Creates a new [Address] instance from a map. | ||
factory Address.fromNative(Map<Object?, Object?> data) { | ||
final List<Object?>? addressLines = data['addressLines'] as List<Object?>?; | ||
final AddressType type = AddressType.fromRawValue( | ||
data['type'] as int? ?? 0, | ||
); | ||
|
||
if (addressLines == null) { | ||
return Address(type: type); | ||
} | ||
|
||
return Address( | ||
addressLines: List.unmodifiable(addressLines.cast<String>()), | ||
type: type, | ||
); | ||
} | ||
|
||
/// The address lines that represent this address. | ||
final List<String> addressLines; | ||
|
||
/// Gets type of the address. | ||
final AddressType type; | ||
} |
Oops, something went wrong.